I'm not sure it's possible to do it solely in mysql... the way I've done such a thing is to group by date in the data table in mysql, get all of the results into an associative array (assuming we're talking php here) indexed by the date, then do a loop in php through each date and see if there's a record in the array of results for that date.

Marcin Szkudlarek wrote:
The reason is simplicity. I want to join this data with my table in
mysql and then do grouping by date. This way the I'll get one row per
each day in the result.

On 15/02/07, Brian Dailey <[EMAIL PROTECTED]> wrote:
I would highly suggest using whatever programming language you're using
to compile this list, and not MySQL. Is there a reason you're doing this
in MySQL and not in the programming language itself?

Marcin Szkudlarek wrote:
> That's a correct solution but unfortunately not for this problem.
> The query shouldn't use any table.
>
> On 15/02/07, Ellen Coen <[EMAIL PROTECTED]> wrote:
>> SELECT * FROM tablename WHERE datefield BETWEEN '2007-01-15' AND
>> '2007-01-24' ;
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Marcin Szkudlarek
>> Sent: Thursday, February 15, 2007 4:19 AM
>> To: [email protected]
>> Subject: [mysql] question about date range
>>
>> Hi all,
>> How i can produce a range of dates with a query?
>> For example: for a given 2 dates: 2007-01-15 and 2007-01-24 the
>> following output should be generated:
>> 2007-01-15
>> 2007-01-16
>> 2007-01-17
>> 2007-01-18
>> 2007-01-19
>> 2007-01-20
>> 2007-01-21
>> 2007-01-22
>> 2007-01-23
>> 2007-01-24
>> Notice that there are 10 rows in the result.
>> Regards,
>>
>> Marcin
>> _______________________________________________
>> New York PHP Community MySQL SIG
>> http://lists.nyphp.org/mailman/listinfo/mysql
>>
>> NYPHPCon 2006 Presentations Online
>> http://www.nyphpcon.com
>>
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>> _______________________________________________
>> New York PHP Community MySQL SIG
>> http://lists.nyphp.org/mailman/listinfo/mysql
>>
>> NYPHPCon 2006 Presentations Online
>> http://www.nyphpcon.com
>>
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>>
> _______________________________________________
> New York PHP Community MySQL SIG
> http://lists.nyphp.org/mailman/listinfo/mysql
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php


--
Rob Marscher
Software Engineer
[EMAIL PROTECTED]
212.684.9100x17

_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to