how to write the query to select the rows are in the order
of either 1,3,5,7... or 2,4,6,8,...
Answer Posted / rajesh verma
1> incase of 2,4,6,8,...
select col1,col2 from tab1 where col1 in
(Select case when Row_number() over (order by col1)%2=0
then col1 else 0 end from tab1)
2> in case of 1,3,5,7,....
select col1,col2 from tab1 where col1 in
(Select case when Row_number() over (order by col1)%2=1
then col1 else 0 end from tab1)
Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What are the encryption mechanisms in sql server?
What is bookmark link in ssrs?
How can I check if a view exists in a sql server database?
Is t sql the same as sql server?
Can primary key be a foreign key?
Explain query editor regions
What is the use of for clause?
What is trace flag in sql server?
what is database replicaion? What are the different types of replication you can set up in sql server? : Sql server database administration
What do you understand by intent locks?
What is the difference between char and varchar2 datatype in sql?
What is a constant or literal in ms sql server?
What is the difference between truncate and delete commands?
What is temporal data type?
How can we determine what objects a user-defined function depends upon?