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
How does a trigger work?
Can we join tables without foreign key?
What are different types of tables in sql?
what is a database? : Sql dba
What are the operators in sql?
What is sp_helptext?
What is primary key secondary key alternate key candidate key?
What are different types of keys?
What is the difference between a query and a report?
Why do you partition data?
What are the two different parts of the pl/sql packages?
what are the differences among rownum, rank and dense_rank? : Sql dba
how can we take a backup of a mysql table and how can we restore it. ? : Sql dba
What is left join in postgresql?
Lookups are a key component in sql server integration services (ssis). Explain its purpose?