tags:

views:

23

answers:

1

Hello, I have a table who looks something like this:

USERNAME    DATA   DATETIME
Jhon        text1  2010-06-01 16:29:43
Mike        text2  2010-06-01 16:29:22
Silver      text3  2010-05-23 06:19:12
Jhon        text1  2010-02-01 01:02:00

What is the php command if i want the DATA from the LAST entry made by Jhon ??? Thanks!

+2  A: 

SELECT data FROM table WHERE username = 'Jhon' ORDER BY datetime DESC LIMIT 1

The "order by datetime desc" paired with "limit 1" gets you his last entry.

eykanal