Yes that is much better.
 
 Thanks again!
 Ken
 

Igor Tandetnik <[EMAIL PROTECTED]> wrote: Ken  wrote:
> The 22 is kind of like a time stamp..  (or you could just as easily
> add another column indicative of a timestamp.
>
> insert into stack values (1, 1234);
> insert into stack values (2, 1234);
> insert into stack values (6, 1234);
> insert into stack values (9, 1234);
> insert into stackpop values (12, 1234) ;
> insert into stackpop values (14, 1234) ;
> insert into stackpop values (18, 1234) ;
> insert into stack values (22, 1234);
>
> so  that 12 should pop 9, 14 pops 6 and 18 pops 2  leaving the stack
> with 1 and 22.

Ah, I didn't realize the ids are supposed to act like timestamps. In 
this case, you would need something like this:

select p.id, max(s.id) from stack s, stackpop p
where s.value = p.value and s.id < p.id and
    (select count(*) from stack s2 where s2.id between s.id and p.id) =
    (select count(*) from stackpop p2 where p2.id between s.id and p.id)
group by p.id;

Igor Tandetnik 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to