Re: TOP 100 in SQL
Posted in 1998
This algorithm is really great, did you find it by yourself ? If yes, you=20=
are=20
very good in SQL language=2E
How did you do it ?
=20
Douglas Agnew <dagnew@bellsouth=2Enet> on 11/12/98 11:38:15 AM
Please respond to Douglas Agnew <dagnew@bellsouth=2Enet>
To: informix-list@iiug=2Eorg
cc: (bcc: Rafal Furdzik/PaulWeiss)
Subject: Re: TOP 100 in SQL
without the first 100 capability:
1=2E create a view x (a, total) as
select a, sum(b) from c
group by a;2=2E then select a, total from x t1
where (select count(a) from x t2 where t2=2Etotal >
t1=2Etotal) < 100
It works --- but it is expensive=2E better to write application=2E
Doug Agnew (dagnew@charlottepipe=2Ecom)
rfurdzik@paulweiss=2Ecom wrote:
> How to display only first 100 rows from a query ??? Please help
>
> Select a, sum(b)
> group by a DESC>
> __________________________________________________
>
> This message is intended only for the use of the=3D20
> Addressee and may contain information that is=3D20
> PRIVILEGED and CONFIDENTIAL=3D2E If you are not the
> intended recipient, you are hereby notified that
> any dissemination of this communication is
> strictly prohibited=3D2E If you have received this
> communication in error, please erase all copies of
> the message and its attachments and notify us
> immediately=3D2E Thank You=3D2E
> __________________________________________________
__________________________________________________
This message is intended only for the use of the=20
Addressee and may contain information that is=20
PRIVILEGED and CONFIDENTIAL=2E If you are not the
intended recipient, you are hereby notified that
any dissemination of this communication is
strictly prohibited=2E If you have received this
communication in error, please erase all copies of
the message and its attachments and notify us
immediately=2E Thank You=2E
__________________________________________________