limit is not ANSI SQL, and in fact, not that many SQL's have a limit key
word. MySql is one that does.
Some other possibilities for example in MS SQL 7.0 or higher, you can use
something like:
SELECT TOP 10 Column1, Column2
FROM Table WHERE Somecolumn NOT IN
(SELECT TOP 200 Somecolumn from Table
ORDER BY SomeOtherColumn)
ORDER BY SomeOtherColumn
That simple example would return results 201-210 of the total set in the
table. Modify and complicate to your heart's desire.
Some versions of Oracle (Which also does not have a limit key word) use a
virtual count column, but I'll have to defer on explaining that one - I
don't have enough hands on with Oracle.
Some other SQL versions (Like Sybase, or MS before version 7) you can use a:
SET ROWCOUNT 10
Before queries to take the top 10 results for example (But be careful with
set rowcount, remember to set it back to 0 before you do in insert or an
update that might affect multiple records, or if there are triggers on the
table....set rowcount will limit how many rows a trigger can affect also).
So the answer is that it depends on your DBMS. These are a few little ideas,
but the actual answer will vary between DBMS's.
Enjoy,
Steve Howard
-----Original Message-----
From: Abdulaziz Ghuloum [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 1:19 PM
To: Rajeev Rumale; [EMAIL PROTECTED]
Subject: Re: Paging the Data..
You can limit the number of records returned by the query by using the SQL
LIMIT modifier
"select * from mytable where status = 1 limit 10;"
Consult *your* database engine for more information.
Aziz,,,
On Tue, 26 Jun 2001 19:41:45 +0800, Rajeev Rumale said:
> Hi,
>
> I have a SQL query which returns me a very large number of records. since
it
> is not good to list them all I want to *page* them.( Displaying a fixed
> number of records at a time) and the more forward and back ward. Just
like
> the serch engines display their results.
>
> I would like to know if there is a effecient solution for same.
>
> with regards
>
> Rajeev Rumale
> >
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com