+ 2
If where selects how could i select, like every OTHER id?
2 Answers
+ 2
You use:
SELECT * FROM example_1
WHERE ID !=1
+ 1
Havent tested this but you could likely use a combination of ROW_NUMBER and the remainder operator - %.
For example:
WHERE (ROW_NUMBER % 2 = 0) should give you all records in even rows.
WHERE (ROW_NUMBER % 2 = 1) should give you all records in odd rows.
If you're using this to provide a "random" result you need to be aware this isn't random.
A better way may be to SELECT TOP (# number of records) and ORDER BY newid().
This assigns a psudo-random id to each record and then sorts by tha random id and provides you with a pre-set number of results.