Couldn't get this to work yet. What would be the full SQL, including the order by clause?
RBS On Thu, Mar 24, 2011 at 7:13 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > 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 > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users