Solution 1: SQL Server Equivalent To MySQL And PostgreSQL Limit Clause - Joseph Scott’s Blog. Note: assumes unique keys.
SELECT TOP n *
FROM tablename
WHERE key NOT IN (
SELECT TOP x key
FROM tablename
ORDER BY key
)
Solution 2: Finally a LIMIT clause for MS SQL. (Same solution recommended here, with a small explanation.)
select * from (
select top 10 emp_id,lname,fname from (
select top 30 emp_id,lname,fname
from employee
order by lname asc
) as newtbl order by lname desc
) as newtbl2 order by lname asc
Edit: The above is in SQL Server 2k... for 2005 there's a new row_number() function.
new⇒I hate ASP.NET
CF, why pick that piece of trash?Cold Confusion. Is it finallyreally a OO...
ColdConfusion: Sep 5, 8:36pm