Re: Selecting last record only

From: Date: Wed, 21 Jan 2004 19:55:23 +0000
Subject: Re: Selecting last record only
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32557@lists.php.net to get a copy of this message
Reverse the order and limit the result to 1. For example, change: SELECT date, item from some_table To: Select date, item from some_table ORDER BY date DESC LIMIT 1 to get the latest dated item. -Micah On Wed January 21 2004 11:49 am, -{ Rene Brehmer }- wrote: > Hi gang > > this is probably ridicously simple, but I'm new at this SQL stuff, so am a > bit stumped. > > It's pretty simple: how do I get only the last record from a single table? > > Trying to convert my file-based website into DB-based, but can't quite > figure out how to do this simple task. > > Table name is history, and only have 3 fields: > histID, date, entry > > I need it to pick the last record without knowing the date of it. Got > picking specific records down good, but be damned if I can figure this one > out... > > TIA > > Rene > Rene Brehmer > aka Metalbunny > > http://metalbunny.net/ > References, tools, and other useful stuff...

« previous php.db (#32557) next »