Facebook

Select Alternate Row SQL Server

Their are many approaches to get alternate record from SQL server database table. Here i have discussed 2 approaches1. Complex Query2. Using Views Complex Query: SELECT * from (SELECT ROW_NUMBER() OVER(ORDER BY Employee_id) as RowNumber, * from employees) T where t.RowNumber%2=0 Using Views:CREATE VIEW with_rownumberasSELECT ROW_NUMBER() OVER(ORDER BY Employee_id) as RowNumber,* from employees; SELECT * from […]