Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL Query
Santosh,
Till now you haven't exactly specified what you want and WHY you want such a thing.
So I can only make a guess at what you want. If you want the age of the last record to be shown with the name of the first record and so on, then following is the query:
SQL> SELECT * FROM test;
NAME AGE
---------- ----------
ANAND 1 BALU 2 CHANDU 3 DAVID 4
SQL> SELECT t1.name, t2.age
2 FROM (SELECT rownum r1, name FROM test) t1
3 , (SELECT rownum r2, age FROM test) t2
4 WHERE t1.r1 + t2.r2 - 1 = (SELECT
5 count(*) FROM test)
6 /
NAME AGE
---------- ----------
DAVID 1 CHANDU 2 BALU 3 ANAND 4 SQL> I'm stupid!!!!!
Regards
Naveen
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Naveen Nahata
INET: naveen_nahata_at_mindtree.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Oct 03 2002 - 08:38:27 CDT
![]() |
![]() |