Tuesday, October 6, 2009

How to implement keyword "Limit" like functionality in MS SQL Server

select * from mytable limit 10, 20

the equivalent in MS SQL Server would be:

select top 20 * from mytable where pk not in (select top 10 pk from mytable order by pk) order by pk

Share This!

No comments:

Powered By Blogger · Designed By Seo Blogger Templates