2012/4/16 Petite Abeille <petite.abei...@gmail.com>: > On Apr 16, 2012, at 9:09 PM, Kit wrote: >> SELECT doc.record, t.rec FROM doc LEFT JOIN t ON doc.id=t.doc_id >> WHERE doc.id=id_xx AND created_on<=time_xx >> ORDER BY created_on DESC LIMIT 1;
> - how do you represent deleted rows? I will create a new record with attribute "deleted" and new timestamp. > - how do you avoid version ambiguities (e.g. two rows created with the same > timestamp)? UNIQUE index on (t.doc_id,t.created_on) ---------------- A modified select: SELECT doc.record, t.rec, t.created_on FROM doc LEFT JOIN t ON doc.id=t.doc_id WHERE doc.id=id_xx AND created_on<time_xx GROUP BY t.doc_id HAVING created_on=max(created_on); -- Kit _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users