Re: [sqlite] Re: Select the top N rows from each group

2007-05-11 Thread Yuriy Martsynovskyy
Igor, select * from (select * from fruits where type = 'apple' order by price limit 2) union all select * from (select * from fruits where type = 'orange' order by price limit 2) SQlite allows only one LIMIT clause per query, that is applied to the final resultset

[sqlite] Re: Select the top N rows from each group

2007-05-11 Thread Igor Tandetnik
Yuriy Martsynovskyy <[EMAIL PROTECTED]> wrote: I need to select top 2 (or N) most expensive fruits of each type from this table: +++---+ type | variety| price | +++---+ apple | gala | 2.79 | apple | fuji | 0.24 | apple |