[thelist] php/mysql get next two records

Phil Turmel philip at turmel.org
Mon Feb 7 05:16:58 CST 2005


Ken Schaefer wrote:
[snip]
> Can you use TOP in mySQL?
[/snip]

No, but it does support a "LIMIT" clause which does the same in it's 
simplest syntax:

SELECT
	<whatever fields>
FROM
	myTable
WHERE
	myField => myCriteria
ORDER BY
	myField
LIMIT 3

(It does have to be specified after the ORDER clause.)

For more details:
http://dev.mysql.com/doc/mysql/en/select.html

HTH,

Phil


More information about the thelist mailing list