7 messages in com.mysql.lists.mysqlRe: LIMIT Question| From | Sent On | Attachments |
|---|---|---|
| Dirk Bremer | 28 Jun 2006 13:15 | |
| Dan Buettner | 28 Jun 2006 13:27 | |
| Dirk Bremer | 28 Jun 2006 13:39 | |
| Chris White | 28 Jun 2006 13:46 | |
| Dan Buettner | 28 Jun 2006 13:53 | |
| Dirk Bremer | 28 Jun 2006 14:18 | |
| William R. Mussatto | 29 Jun 2006 09:30 |
| Subject: | Re: LIMIT Question![]() |
|---|---|
| From: | Dan Buettner (drbu...@gmail.com) |
| Date: | 06/28/2006 01:27:20 PM |
| List: | com.mysql.lists.mysql |
Depends what you mean by "last" - you could show the 50 with the latest datestamps by ending your query with something like:
ORDER BY datestampcolumn DESC LIMIT 50;
or the 50 with the highest ID numbers, same thing:
ORDER BY id DESC LIMIT 50;
only real problem there is then they're sorted highest to lowest, but it is still the "last" 50.
Dan
On 6/28/06, Dirk Bremer <Dirk...@nisc.coop> wrote:
Is there a way to use a LIMIT clause to show the last X amount of rows or a way to emulate this behavior? For example, a table has somewhere between 1000 and 2000 rows, but you just want to see the last 50. These last 50 might be the most recent entries, for example. Can this be done in single query?
Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO - USA Central Time Zone 636-755-2652 fax 636-755-2503
dirk...@nisc.coop www.nisc.coop
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=drbu...@gmail.com




