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 / innaci

select a,d from (select a,d,rownum as n from (select f1.a,
f2.d from
(select f1 as a from sample1 order by 1) f1,
(select f1 as d from sample1 order by 1 desc) f2) temp)
temp1 where mod(n,(select count(f1) from sample1)+1)=1

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain locks? : Transact sql

575


Do stored procedures prevent sql injection?

550


What is the requirement of self-join?

546


How do I count rows in sql query?

491


what is the syntax used for partition in tsql? : Transact sql

540






How can you tell the difference between an index and a view?

494


How do I clear the screen in sql plus?

551


how can we destroy the session, how can we unset the variable of a session? : Sql dba

550


How do you change a value in sql?

556


What are the two virtual tables available at the time of database trigger execution?

640


Is primary key always clustered index?

536


What is exception? What are the types of exceptions?

558


How we can update the view?

601


What are the advantages of normalization?

558


What is %s in sql?

565