david_88
asked on
SQL only return range of records
Is there sql to only return back a range of records i.e from 20-30 in access. or are there any easy work arrounds to this problem
thanks
dave
thanks
dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
this is example of SQL paging. You can simply modify it as you need:
top_onPage = "TOP " + Convert.ToString((onPage * page > totalCount) ? (totalCount % onPage) : (onPage));
top_page = "TOP " + Convert.ToString(onPage * page);
SELECT * FROM (
SELECT TOP " + top_onPage + " id FROM (
SELECT DISTINCT " + top_page + " T.id
FROM dbo.tblTest T
) as A ORDER BY X ASC
) as B ORDER BY X DESC
this is example of SQL paging. You can simply modify it as you need:
top_onPage = "TOP " + Convert.ToString((onPage * page > totalCount) ? (totalCount % onPage) : (onPage));
top_page = "TOP " + Convert.ToString(onPage * page);
SELECT * FROM (
SELECT TOP " + top_onPage + " id FROM (
SELECT DISTINCT " + top_page + " T.id
FROM dbo.tblTest T
) as A ORDER BY X ASC
) as B ORDER BY X DESC
ASKER
perect thanks!
Something like
SELECT * FROM Table1 WHERE ((Table1.ID) Between 20 And 30);
Good Luck!
Gary