* saraswathy saras
> How to select latest 3 days records  from the table  according to the 
> latests date.
> The data is like this:-
> 
> name  date
> a     02-03-01
> b     02-03-15
> c     02-03-20
> d     02-03-20
> e     02-04-28
> f     02-04-28
> g     02-04-30
> 
> The result should be like this:-
> 
> name  date
> g     02-04-30
> f     02-04-28
> e     02-04-28
> c     02-03-20
> d     02-03-20
> 
> 
> Is it possible.Please help me.

Yes, use ORDER BY ... DESC and LIMIT:

  SELECT * FROM table ORDER BY date_field DESC LIMIT 3

<URL: http://www.mysql.com/doc/S/E/SELECT.html >

-- 
Roger

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to