Home » SQL & PL/SQL » SQL & PL/SQL » SQL, ROWNUM and ORDER BY
SQL, ROWNUM and ORDER BY [message #20229] Wed, 08 May 2002 05:49 Go to next message
Jürgen Jesenko
Messages: 1
Registered: May 2002
Junior Member
Hi there...

I would like to get the top 100 user of my product.
So I started a query, which ended like this:
.
.
.
order by
count(*) desc,
where rownum < 101
;

I just wanted the query to stop after row number 100.

But it doesn't work....
I still get all users.

I am useing SQL Navigator...

Please help!!!
Re: SQL, ROWNUM and ORDER BY [message #20231 is a reply to message #20229] Wed, 08 May 2002 06:34 Go to previous message
sridhar
Messages: 119
Registered: December 2001
Senior Member
If I am understanding your question correctly, you want the top 100 users by their count being the measurement. Following does that for you..

SELECT user FROM
(SELECT user FROM product
GROUP BY user
ORDER BY count(*) desc)
WHERE ROWNUM <= 100;

Thx,
Sri
Previous Topic: Remove all schema objects
Next Topic: clob and microsoft provider
Goto Forum:
  


Current Time: Fri Apr 19 23:01:18 CDT 2024