Subject Re: [firebird-support] Top N Orders
Author Helen Borrie
At 10:29 AM 16/07/2003 +0100, you wrote:
>Hi All,
>Can I've a top N query where I can get the top N data for a particular
>group. For example :
>I've a sales tables which contain data for each & every sale. I want ot
>have Top 2 sales of each month.
>The 'Select First X.....' clause seems to be only for the result set & not
>the group.

The point about SELECT FIRST m is that it is designed to operate on an
*ordered set*. All you need to do is design the set and SELECT FIRST will
do the rest.
e.g.
select first 2 <column-list> from sales
where sales_date between <adate> and <bdate>
order by sale_total desc

heLen