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

2007-05-11 Thread Yuriy Martsynovskyy
Igor, That's not quite true. ORDER BY and LIMIT are allowed in sub-selects, as is the case here. This query works, I tested it before posting. Your query returns 2 records instead of 4. I'm testing it on SQLite v3.3.10

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

2007-05-11 Thread Igor Tandetnik
Yuriy Martsynovskyy <[EMAIL PROTECTED]> wrote: 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