On 3/24/2011 3:00 PM, Bart Smissaert wrote: > SQLite objects against this SQL, particularly the first t1 after xxx > > 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)
delete from xxx where entry_id not in ( select entry_id from xxx where xxx.patient_id = patient_id); xxx. prefix resolves to the first mention of xxx in the query, which happens to be DELETE FROM clause. It's a bit scary, but it works. Unfortunately, SQL syntax as implemented by SQLite doesn't allow an alias in DELETE FROM. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users