i have a table MEN in sql server 2008 that contain 150 rows.
how i can show only the even or only the odd rows ?
Check out ROW_NUMBER()
SELECT t.First, t.Last FROM ( SELECT *, Row_Number() OVER(ORDER BY First, Last) AS RowNumber --Row_Number() starts with 1 FROM Table1 ) t WHERE t.RowNumber % 2 = 0 --Even --WHERE t.RowNumber % 2 = 1 --Odd
2.1m questions
2.1m answers
60 comments
57.0k users