A simple restatement should work:

delete
from xxx
where entry_id in (select
t1.entry_id
from
xxx t1
where not
t1.entry_id in(select
t2.entry_id
from
xxx t2
where
t1.patient_id = t2.patient_id
order by
t2.start_date desc limit 1))

On 3/24/2011 12:00 PM, Bart Smissaert wrote:
> delete
> from
> xxx t1
> where not
> t1.entry_id in(select
> t2.entry_id
> from
> xxx t2
> where
> t1.patient_id = t2.patient_id
> order by
> t2.start_date desc limit 1)
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to