Hi,
This might work for you:

select @tempvar := max(datecolumn) from tablename group by datecolumn order 
by datecolumn desc limit 3;
select * from tablename where datecol >= @tempvar order by datecolumn desc;

Anvar.

At 06:12 AM 02/05/2002 +0000, you wrote:
>hi everyboby,
>
>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.
>
>query,database,sql
>
>Thanks in advance.
>
>
>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
>---------------------------------------------------------------------
>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
>


---------------------------------------------------------------------
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