Hi,
I want to know the alternative of the TOP keyword as in mysql.
I have read about Top Keyword in SQL.
Is there any alternative for that in MYSQL.
Or any other method in mysql from which we can get same functionality.
Thanks
Avinash
Hi,
I want to know the alternative of the TOP keyword as in mysql.
I have read about Top Keyword in SQL.
Is there any alternative for that in MYSQL.
Or any other method in mysql from which we can get same functionality.
Thanks
Avinash
Ordering and limiting the results:
SELECT field1, field2
FROM myTable
ORDER BY field1 ASC
LIMIT 10
yes, there is the limit clause.
Example:
SELECT * FROM `your_table` LIMIT 0, 10
This will display the first 10 results from the database.
You can use the LIMIT
keyword (See the documentation of the SELECT
instruction) -- it goes at the end of the query :
select *
from your_table
where ...
limit 10
to get the top 10 lines
Or even :
select *
from your_table
where ...
limit 5, 10
To get 10 lines, startig from the 6th (i.e. getting lines 6 to 15).
mysql equivalent of top and you can find further more about LIMIT in MySql Doc