Hello,

I think Mr. Carlson requires to output all the dates between two given dates.

This can be done with defined variables and an auxiliary table, the 
requirement
being that it should have at least as many rows as there are days between the
dates and to directly give the number of days between the dates in the 
limit clause.
(Hope in the future mysql will accept variables in the limit clause and also in
IN clause).

Select @stdate := '2002-02-07';
Select @stdate := @stdate + interval 1 day from tablename limit 5;

Anvar.

At 03:56 PM 06/05/2002 +0300, you wrote:
>Hello,
>Tim Carlson wrote:
>
>>Hello,
>>
>>Newbie SQL person here. I am hoping to be able to do the
>>following. Given two dates, I would like to display all of the days
>>between them.
>>
>>So if I had the dates 2002-02-08 and 2002-02-12, I would like to have
>>MySQL spit back
>>
>>2002-02-08
>>2002-02-09
>>2002-02-10
>>2002-02-11
>>2002-02-12
>>
>>Any way I can do this directly in MySQL without constructing a table? I've
>>looked through the date maniplulation routines in the manual, but nothing
>>jumps out at me. Any pointers would be appreciated.
>Suppose you have some table with column called date_col DATE. i.e. 
>containing dates as above
>Now if your question is:
>How to select all rows where is true that date_col is between dates 
>2002-02-08 and 2002-02-12?
>
>You can use almost same spelling. (SQL is written to be close to natural 
>english)
>
>mysql> SELECT date_col FROM your_table WHERE date_col BETWEEN '2002-02-08' 
>AND '2002-02-12';
>
>will be valid statement :)
>
>--
>Best regards
>--
>For technical support contracts, visit https://order.mysql.com/
>   __  ___     ___ ____  __
>  /  |/  /_ __/ __/ __ \/ /    Mr. Alexander Keremidarski 
> <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Full-Time Developer
>/_/  /_/\_, /___/\___\_\___/   Sofia, Bulgaria
>       <___/   www.mysql.com M: +359 88 231668
>
>
>
>
>
>---------------------------------------------------------------------
>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