Getting every other record of a table.
Posted on 2006-11-28
I want to have two queries written in standard sql (no "declare", no cursors etc.).
The first query has to return record no 1, 3, 5, 7 ... etc... - of a table containing names that will have to be sorted alphabetically.
The second has to return record 2, 4, 6, 8 ... etc... - of the same table.
There is no incrementally numbered id.
The result should look something like this:
result query1 result query 2
The query has to be written in standard SQL because it is supposed to be used in a gridview in MSSQL 2005 without using stored procedures...
Can it be done?