Thanks; yes, that works.
Will need to add maybe a compound index to make it faster.

RBS


On Fri, Apr 23, 2010 at 11:38 PM, Igor Tandetnik <[email protected]> wrote:
> Bart Smissaert wrote:
>> Simplified there is a table like this:
>>
>> create table xxx(
>>    [entry_id] integer primary_key,
>>    [person_id] integer)
>>
>> Now I need to retrieve the rows with the 3 highest entry_id numbers
>> for each person_id.
>
> select * from xxx t1
> where rowid in (
>  select rowid from xxx t2
>  where t1.person_id=t2.person_id
>  order by t2.entry_id desc limit 3);
>
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to