Try this:

select * from visitor where
 datestamp between
 date_sub(now(), interval 5 day) and
 date_sub(now(), interval 2 day)
 order by datestamp desc;

Regards,

Gary "SuperID" Huntress

=======================================================
FreeSQL.org offering free database hosting to developers
Visit http://superid.dyndns.org:8080/freesql/index.php

----- Original Message -----
From: "Stefen Lars" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 31, 2001 1:31 PM
Subject: Selecting 3 days worth of data with an offset of 5 days from now()


> Hello all
>
> I am looking for a way to return 3 days worth of data with an offset of
five
> days (in the past) from today.
>
> For example, say we had the following dates and today is 2001-03-31. First
> we do:
>
> select name, datestamp from visitor_data order by datestamp desc;
>
> and are returned with this list
>
> name datestamp
>
> jon 2001-03-31
> peter 2001-03-29
> sam 2001-03-26
> joe 2001-03-25
> pete 2001-03-25
> zed 2001-03-25
> chris 2001-03-24
> paul 2001-03-22
> simon 2001-03-22
>
> Now, I am looking for a way to return just the following data:
>
> sam 2001-03-26
> joe 2001-03-25
> pete 2001-03-25
> zed 2001-03-25
> chris 2001-03-24
>
> How can this be done?
>
> I would be really very grateful if someone could point me in the right
> direction or offer a link to a resource with some example of what I would
> like to do. I already looked in the manual and the example:
>
> SELECT something FROM table WHERE TO_DAYS(NOW()) - TO_DAYS(date_field) <=
> 30;
>
> is interesting, but is not really what I want to do.
>
> If anyone can help me, I thank you whole-heartedly in advance.
>
> S.
>
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> ---------------------------------------------------------------------
> 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