|
On 1/11/07, Richard Casey <casey_r@xxxxxxxxxxxxxxxx> wrote:
The full form of the FETCH clause is "FETCH FIRST nnn ROWS ONLY". That is handy for selecting a subset of your complete result set. With ORDER BY xxx and GROUP BY xxx/HAVING xxx, you can do all sorts of stuff. For example, getting a list of the top 10 customers based on total number of transactions is as easy as: SELECT customer,count(*) FROM transactionfile GROUP BY customer ORDER BY count(*) desc FETCH FIRST 10 ROWS ONLY
Now I can see value in that. Thanks for the explanation Richard! - Dan
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.