Thread: Postgresql and Top N Analysis?

Postgresql and Top N Analysis?

From
"Katka a Daniel Dunajsky"
Date:
Hello all,

Can anyone give me an hit how to do Top 'N' Analysis in postgresql (if it is 
possible)?
I see that postgresql does not have an pseudocolumn rownum, therefore I 
can't use query like this:

SELECT   *
FROM     (SELECT DISTINCT session_type_id FROM user_sessions ORDER BY 
session_type_id) as dummy
GROUP BY dummy;

Thank you for your time.

Daniel

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



Re: Postgresql and Top N Analysis?

From
Larry Rosenman
Date:

--On Tuesday, May 13, 2003 15:32:57 -0600 Katka a Daniel Dunajsky 
<daniel_katka@hotmail.com> wrote:

> Hello all,
>
> Can anyone give me an hit how to do Top 'N' Analysis in postgresql (if it
> is possible)? I see that postgresql does not have an pseudocolumn rownum,
> therefore I can't use query like this:
>
> SELECT   *
> FROM     (SELECT DISTINCT session_type_id FROM user_sessions ORDER BY
> session_type_id) as dummy GROUP BY dummy;
>
> Thank you for your time.

look at the LIMIT parameter of SELECT, If I'm reading you right.





-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749