Home » RDBMS Server » Server Administration » ORDER BY and rank
ORDER BY and rank [message #372051] Sun, 07 January 2001 20:34 Go to next message
Datch
Messages: 1
Registered: January 2001
Junior Member
 -------+--------
 | Item | Qty   |
 -------+--------
 | AAAA |    10 |
 | BBBB |    15 |
 | CCCC |     3 |
 | DDDD |   200 |
 -------+-------- 


Let's suppose I want to have the rank of ITEM "CCCC" when the table is ordered by QTY. What should I Do?
Re: ORDER BY and rank [message #372057 is a reply to message #372051] Mon, 08 January 2001 13:17 Go to previous message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi
select rownum rank, item, qty from
(select item, qty from
t1 order by qty desc);
Rank Item Qty
1 DDDD 200
2 BBBB 15
3 AAAA 10
4 CCCC 3

Bala
Previous Topic: Finding the common records
Next Topic: star schema to demormalized table
Goto Forum:
  


Current Time: Sat May 18 03:25:22 CDT 2024