[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: Re: Selecting 3 days worth of data with an offset of 5 days from
From: Bob Hall <rjhalljr () starpower ! net>
Date: 2001-03-31 15:27:23
[Download RAW message or body]
WHERE datestamp BETWEEN Date_sub(CURRENT_DATE, INTERVAL 5 DAY)
AND Date_sub(CURRENT_DATE, INTERVAL 7 DAY)
>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 <mysql-thread70117@lists.mysql.com>
>To unsubscribe, e-mail
><mysql-unsubscribe-rjhalljr=starpower.net@lists.mysql.com>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
---------------------------------------------------------------------
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 <mysql-thread70128@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic