Re: get row (latest by date)

From: Date: Thu, 09 Jan 2003 15:46:23 +0000
Subject: Re: get row (latest by date)
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-17733@lists.php.net to get a copy of this message
select * from table where date=(select max(date) from table) and time=(select max(time) from table) HTH, Radovan "Aidal" <aidal@nospam.dk> wrote in message news:20030109130550.9568.qmail@pb1.pair.com... > Hi NG. > > I know this is probably very simple, but I've had no luck making it work :( > > I want 1 single row out of a table, that row must be the latest by date and > time. > > The table looks like this (example MySQL): > _______________________________________________ > id | type_id | date | time | title | > source | > --------------------------------------------------------------- > 128 | 1 | 2003-01-09 | 15:00:52 | some title | blabla | > 129 | 1 | 2003-01-09 | 15:02:43 | some title 2 | blabla 2 | > --------------------------------------------------------------- > > What i need is the SQL that would give me the latest created row of these 2 > (i dont mean latest as in last_id) by date and time in this case the result > should be the row with id = 129 because of the time. > > Please help... > > ~ Aidal > > > >

« previous php.windows (#17733) next »