On 3/24/2011 3:32 PM, Bart Smissaert wrote:
> Couldn't get this to work yet.
> What would be the full SQL, including the order by clause?

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

Deletes all but the most recent entry for each patient. Is this what you 
are after?
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to