List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:November 26 2002 6:51pm
Subject:Re: LIMIT in MySQL
View as plain text  
At 12:56 PM -0500 11/26/02, Mike At Spy wrote:
>I must not be awake yet.  Why is this query sending me back 60 records?
>Shouldn't it only send back records 30 through 60 (i.e. 30 records)?
>
>SELECT * FROM table ORDER BY somefield LIMIT 30,60
>
>Thanks,
>
>-Mike


As computers are wont to do, it's sending back what you asked for ;)

The first LIMIT parameter is the starting row (starting at 0), the 
second is the number of records to return. So it's returning the 31st 
through 90th records.

CHeck about 1/2 thee way down

	http://www.mysql.com/doc/en/SELECT.html

for more info.


-steve
-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| SETI@Home: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
+------------------------------------------------------------------------+
Thread
LIMIT in MySQLMike At Spy26 Nov
  • RE: LIMIT in MySQLDavid Shanes26 Nov
  • Re: LIMIT in MySQLPaul DuBois26 Nov
  • RE: LIMIT in MySQLJim Esten26 Nov
    • Re: LIMIT in MySQLRodney Broom26 Nov
  • Re: LIMIT in MySQLBenjamin Pflugmann26 Nov
  • RE: LIMIT in MySQLJennifer Goodie26 Nov
  • Re: LIMIT in MySQLMatthew Baranowski26 Nov
  • Re: LIMIT in MySQLRay26 Nov
  • Re: LIMIT in MySQLSteve Edberg26 Nov