You are here: How to write a query, filling in dates that aren't there. « PHP SQL « IT news, forums, messages
How to write a query, filling in dates that aren't there.

Posted by laredotornado@zipmail.com on 01/27/07 22:56

Hi,

I have a MySQL 5 table with the following data

DAY SALES
-----------------------------
2006-01-14 24.00
2006-01-18 36.00

How can I write a query that returns other days in January, 2006 with
"0" listed as total sales. So, the first 15 rows of this query would
look like

DAY SALES
------------------------------
2006-01-01 0
2006-01-02 0
2006-01-03 0
2006-01-04 0
2006-01-05 0
2006-01-06 0
2006-01-07 0
2006-01-08 0
2006-01-09 0
2006-01-10 0
2006-01-11 0
2006-01-12 0
2006-01-13 0
2006-01-14 24.00
2006-01-15 0

Thanks for all your help, - Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация