View Full Version : Limit?
Goober
01-03-2004, 03:52 AM
in php code i saw the following in a mysql query:
$stmt = "SELECT
id,
first_name,
last_name
FROM
persons
LIMIT
0, 3";
in that code, what does "LIMIT" mean, and what does it do?
LIMITx, y will return y records, starting from the x'd record in your recordset. But you best include an order by clause, because else, there is no way to be absolutely certain which 3 records you'll get.
Because the tablescan will stop if y records are selected, a select with LIMIT will be ran faster + there will be less datatrafic. LIMIT is frequently used for recordset paging.
Goober
01-03-2004, 08:56 AM
sweet man, thanks :thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.