On Nov 16, 2010, at 11:55 PM, Bart Smissaert wrote:

> This seems to work fine,

Then you are golden :)

> but I am not sure if this SQL is correct and
> if the results will always be correct and have a feeling
> that there must be a better construction.



> Any suggestions?

Nothing very meaningful, but you could rewrite the 'in' clause as a 'join' to 
avoid all these concatenations, e.g.:

select  t1.patient_id
from    table1 t1
join    (
            select      table1.address,
                        min( table1.date_of_birth ) as date_of_birth
            from        table1
            group by    table1.address
        ) 
as      t2
join    t2.address = t1.address
and     t2.date_of_birth = t1.date_of_birth


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

Reply via email to