List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 15 2003 4:11am
Subject:Re: Select newest records
View as plain text  
At 22:07 -0600 3/14/03, Todd W wrote:
>I am having troubles with queries, selecting only the newest records.
>
>Select ID,title,article From news ORDER BY ID LIMIT 0,2
>
>I tried this but it always shows the first two records and I want to select
>the last two records(newest ones added).  Can someone help out?

Sort in descending order.

... ORDER BY ID DESC LIMIT 0, 2

By the way, LIMIT 2 is the same as LIMIT 0, 2.

>
>Thanks
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread134794@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-paul=snake.net@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Select newest recordsTodd W15 Mar
  • Re: Select newest recordsPaul DuBois15 Mar
  • Re: Select newest recordsJeff Kilbride15 Mar