how do i make a select on only the 5 first results

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

how do i make a select on only the 5 first results

Post by pelegk2 »

i want when i make a select on a db to get only the first 5 on loop over them
(and not needingto make a counter from 1 to 5)
thanks
peleg
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

Use limit. For example,

Code: Select all

SELECT * FROM `table1` LIMIT 0 , 5
Should work for your what you want.
Post Reply