List:General Discussion« Previous MessageNext Message »
From:Chris Date:September 23 1999 3:09pm
Subject:Re: Selecting top 20 of a MySQL result.
View as plain text  
Erik, try the 'LIMIT' keyword:

SELECT * FROM table LIMIT 20;

This should do what you need. Also, make sure you have an 'ORDER BY' in
there so that you select the actual first 20 (the order of items retrieved
from the DB is not guaranteed to be anything).

--Chris

On Thu, 23 Sep 1999, Erik Andersson wrote:

> I need to select the first 20 posts from a MySQL result. The standard SQL
> syntax supports TOP 20. Is there a way of doing this in MySQL.
> Like:
> 
> SELECT * FROM table TOP 20;
> 
> / Erik
> 
> 
> 
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread14033@stripped
> 
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
> 

Thread
Selecting top 20 of a MySQL result.Erik Andersson23 Sep
  • Re: Selecting top 20 of a MySQL result.Davor Cengija23 Sep
  • Re: Selecting top 20 of a MySQL result.Chris23 Sep
RE: Selecting top 20 of a MySQL result.Darren L Sweeney23 Sep