Query retrieving [message #372515] |
Sat, 17 February 2001 07:22 |
Arjun Vakharia
Messages: 5 Registered: February 2001
|
Junior Member |
|
|
How do I retrieve a same column in a table in ascending and descending values at a time?
eg. rollno rollno
1 3
2 2
3 1
|
|
|
Re: Query retrieving [message #372527 is a reply to message #372515] |
Tue, 20 February 2001 06:11 |
John R
Messages: 156 Registered: March 2000
|
Senior Member |
|
|
Setup:
Table TEMP:
Name Null? Type
--------- -------- ----
COL_1 NUMBER(5)
Data:
COL_1
---------
1
2
4
8
16
32
64
Query:
SELECT t1.col_1
,t2.col_1
FROM (select col_1,rownum r from temp) t1
,(select col_1,rownum r from temp) t2
WHERE t1.r+t2.r = (SELECT 1+count(*) FROM temp)
Hope this helps
|
|
|
Re: Query retrieving [message #372528 is a reply to message #372515] |
Tue, 20 February 2001 06:12 |
John R
Messages: 156 Registered: March 2000
|
Senior Member |
|
|
Setup:
Table TEMP:
Name Null? Type
--------- -------- ----
COL_1 NUMBER(5)
Data:
COL_1
---------
1
2
4
8
16
32
64
Query:
SELECT t1.col_1
,t2.col_1
FROM (select col_1,rownum r from temp) t1
,(select col_1,rownum r from temp) t2
WHERE t1.r+t2.r = (SELECT 1+count(*) FROM temp)
Hope this helps
|
|
|
|
|