Page 1 of 1

Getting first two records in MySQL query

Posted: Thu Jan 19, 2006 8:31 pm
by flycast
I have a select query that is returning many records and want only the first two records. How do I do this?
SELECT event.*, location.place, seminar.name, seminar.shortdescription, seminar.longdescription, seminar.keywords
FROM event, location, rel_location, rel_seminar, seminar
where (event.id = rel_location.event and rel_location.location = location.id)
and (event.id = rel_seminar.event and rel_seminar.seminar = seminar.id)
and event.display = 1
and event.eventdate > "2006-01-15"
order by indexorder asc, eventdate asc

Posted: Thu Jan 19, 2006 8:49 pm
by Christopher
Append " LIMIT 2" to your SQL.

Posted: Thu Jan 19, 2006 8:55 pm
by flycast
:oops: Forgot about "Limit"
Thanks!