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...

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


Please Help Members By Posting Answers For Below Questions

What are the types of resultset?

914


What is the use of toad or sqldbx.?

1098


What are the differences between triggers and stored procedures?

990


How to make conditional sum in ssrs?

173


How to insert multiple rows with one insert statement in ms sql server?

1054


What are drilldown reports?

140


Explain some stored procedure creating best practices or guidelines?

870


What is the difference between the 2 operating modes of database mirroring?

1055


Write a program to fetch first 10 records from a file?

966


What are the different types of sub-queries?

994


What is sql server programming?

977


Is sql server implemented as a service or an application? : Sql server database administration

894


Explain identity in sql server?

951


What is executereader?

896


Explain what is sql server english query?

986