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 do you mean by recursive stored procedure?

952


Why do we use sql limitations? Which constraints can we use while making a database in sql?

1079


You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?

1035


What is full outer join in sql server joins?

1069


How to access the deleted record of an event?

1040


Do you know the cursor types?

1156


How to drop an existing schema in ms sql server?

1103


How to declare a cursor with "declare ... Cursor" in ms sql server?

1047


What is the purpose of self join?

975


What is difference between delete and truncate commands?

1084


What are the different types of collation sensitivity?

1126


What it means to be triggered?

1009


Differentiate between a primary key and a unique key.

1073


What causes index fragmentation?

997


Explain different types of index?

1064