StatCounter

View My Stats

Tuesday, February 5, 2008

To Select Odd and Even number of records From Table-SQL Server

To select odd numbers of records:

select distinct id1,name1,name2 from a where (id1%2)=1

To Select even numbers of record:

select distinct id1,name1,name2 from a where (id1%2)=0

Here id1 is a Identity column of a Table a
id1-Identity Column
a-TableName

No comments: