Hi all, hopefully not too long a question...

I needs records from 2 tables and in one I need the record with the maximum
ID.  (to retrieve the record of the most recent version)

On other dbms I would do something like this (see below), but I think the
correlation is not available unless I have SQlite 3.1. Right?

So how can I accomplish this task with 2.8.17?

select
t1.id, t1.someprops, t2.latestdata, t2.moredata
from  table1 t1
join table2 t2 on t1.id = t2.id
where t2.id = (
    select max(t2s.id) as maxid
    from table2 t2s
    where t1.id = t2s.id
    );

If I specify an ID in both where clauses, it works fine, but in this case, I
need a list of all records. (and there max matching record in table 2)  Can
we do a join with no subquery?  Where exists?

Thanks for any assistance.

--
Greg Fischer
1st Byte Solutions
http://www.1stbyte.com

Reply via email to