Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

take one table is t1 and in that column name is f1
f1 column values are
200
5000
3000
7000
300
600
100
400
800
400
i want display the values asc and desc in a single output.
sample output is
f1.a
100
200
300
400
500
600
etc......
and f1.d is
5000
4000
3000
2000
1000
etc...

Answer Posted / venkyhulk1

if the output need to be displayed in two columns f1.a , f1.b
the querry will be

select a.f1 "f1.a", c.f1 "f1.b"
from (select rownum r1, f1 from t1) a,(select rownum r1,b.f1
f1 from (select f1 from t1 order by f1 desc) b) c
where a.r1=c.r1

hope this is the shortest querry that one can write in sql
to get this task done .

if u try it in other ways as shown above it will perform
catesian product which results in more rows than required .

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are secondary keys?

919


Can we use threading in pl/sql?

970


Explain the advantages and disadvantages of stored procedure?

1075


does sql support programming? : Sql dba

989


Which are sql * plus commands?

1039


What does count (*) do in sql?

951


How is debugging done?

918


What is database sql?

979


What are aggregate and scalar functions?

973


How many unique keys can a table have?

955


how to analyze tables with 'mysqlcheck'? : Sql dba

957


Why plvtab is considered as the easiest way to access the pl/sql table?

1129


What is difference between procedure and trigger?

914


What is a record in pl/sql?

1067


What is the difference between microsoft access and sql?

958