LifeinAsia

msg:3741291 | 3:23 pm on Sep 9, 2008 (gmt 0) |
It depends on your DB. I believe MySQL allows something like this.
|
Anyango

msg:3741423 | 7:21 pm on Sep 9, 2008 (gmt 0) |
If it is MYSQL Database then you can use the Limit Keyword easily for this for example select * from table limit 10 // Means record 0 to 10 // thats so normal right ? yea but this is the trick select * from table limit 10,20 that means select 20 records after record 10, i think ACCESS database doesnt allow two parameters for the LIMIT keyword, not sure about SQL Server. [edited by: Anyango at 7:22 pm (utc) on Sep. 9, 2008]
|
LifeinAsia

msg:3741482 | 8:49 pm on Sep 9, 2008 (gmt 0) |
Nope- not in MS SQL. There are some kludgy workarounds, but they break down with any complicated queries.
|
blaketar

msg:3741684 | 3:20 am on Sep 10, 2008 (gmt 0) |
SELECT * FROM mytable ORDER BY something LIMIT 10, OFFSET 20 returns rows 10 - 20
|
pritesh

msg:3741729 | 5:14 am on Sep 10, 2008 (gmt 0) |
I am using MSSQL will it work for that also?
|
LifeinAsia

msg:3742030 | 3:30 pm on Sep 10, 2008 (gmt 0) |
| I am using MSSQL will it work for that also? |
| As I previously mentioned, no. See the following for a kludgy workaround (works with the Pubs database): 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
|
mattur

msg:3742062 | 4:09 pm on Sep 10, 2008 (gmt 0) |
There's a good article on paging with SQL Server at aspfaq [databases.aspfaq.com]. (The article covers Classic ASP, but the SQL bits apply to .Net and the stored procedure at the end may be a good solution)
|
carguy84

msg:3743213 | 6:01 am on Sep 12, 2008 (gmt 0) |
SQL 2005 has paging built into it, FYI. We use 2005, but haven't moved to paging yet, we use a simple temp table to order the results and then join that table with the ten results we need.
|
|