Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting a Set of Records returned!! Pls Help

Status
Not open for further replies.

Forri

Programmer
Oct 29, 2003
479
MT
Hi All

When using sql in mySql i usually use the Limit clause to return a set or records starting from a particular record no onwards: something like Limit 5, 20!!

Can this be done using every Database..is it a standard or?

I'm asking this because i trying to create an application that can support several different Database application (Access, MSDE, SQL Server, MySql, Mimer etc).

What do you think? Any idea pls!

Thanks
Nick
 
There's no general solution to your problem. Different DBMS have different implementations.

However the SQL-2003 standard has the construction you are looking for, but I suppose it will take a few years before its generally available.
 
Oh....so Limit 2,5 is not the same in Access as in mySQL!!? ? how ould i know then!?

Thanks
 
That's one of the problems with having all these RDBs around - not everything is standard and DBs vary quite a bit regarding capabilities and code words. So that means a lot of looking at documentation for us. Fortunately there are helpful forums such as this one to make things at least a little easier.

How does Limit work - does it go off sorted key fields so you get 20 records starting at row 15 based on the order of the key fields?

You may be able to do something with correlated subqueries to get what you want. Subqueries are pretty standard across database platforms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top