3 messages in com.mysql.lists.mysqlRe: Select newest records
FromSent OnAttachments
Todd W14 Mar 2003 20:06 
Paul DuBois14 Mar 2003 20:10 
Jeff Kilbride14 Mar 2003 21:04 
Subject:Re: Select newest records
From:Jeff Kilbride (je@kilbride.com)
Date:03/14/2003 09:04:05 PM
List:com.mysql.lists.mysql

I'm assuming you're IDs are getting bigger, so how about ordering them in descending order?

SELECT ID, title, article FROM news ORDER BY ID DESC LIMIT 2

Also, if you're starting from 0, you don't need to include that in the LIMIT clause.

--jeff

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?

Thanks

To request this thread, e-mail <mysq@lists.mysql.com> To unsubscribe, e-mail <mysql-unsubscribe-jeff=kilb@lists.mysql.com> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php