Actually, mysql does not support sub-selects.
You can do this however with something like this:

select * from your_table order by date_column desc, time_column desc limit 1
----- Original Message -----
From: "Radovan Radic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 9:46 AM
Subject: [PHP-WIN] Re: get row (latest by date)


> select * from table where date=(select max(date) from table) and
> time=(select max(time) from table)
>
> HTH,
> Radovan
>
> "Aidal" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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
> >
> >
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to