Thursday 16 August 2012

Select nth row from table in sql server

select * from(
select id,name,row_number() over(order by id) as 'row'  from student)as temp where row=n

Note

To select last row

select top 1 * from student order by id desc // where id is unique column

No comments:

Post a Comment