hi, mankowitz,
Thanks for the help. I thought it might be possible because i found the soulution in a ms access thread:
http://www.experts-exchang
Id rather find a solution that didnt include altering the database. Maybe it might be better for me to look for a solution that includes php.
Main Topics
Browse All Topics





by: mankowitzPosted on 2008-08-24 at 14:30:51ID: 22302103
unfortunately, the only way to do this is make another table that has all the days you want in the range and then make a left outer join with that table.
j.band_tim e), '%Y - %u') as week, j.band_tim e), 'week:%u\n%M %Y') as displaydate,
time)))
so....
suppose you have a table that has all the available band days in it
table band_days: band_time datetime;
You would do a query like this
SELECT DATE_FORMAT(FROM_UNIXTIME(
DATE_FORMAT(FROM_UNIXTIME(
count(j.band_id) as users,
sum( case when(j.band_quota = '-3') then 1 else 0 end) as fan3,
sum( case when(j.band_quota = '-2') then 1 else 0 end) as fan2,
sum( case when(j.band_quota = '-1') then 1 else 0 end) as fan1,
sum( case when(j.band_quota = '1') then 1 else 0 end) as musician1,
sum( case when(j.band_quota = '2') then 1 else 0 end) as musician2,
sum( case when(j.band_quota = '3') then 1 else 0 end) as musician3
FROM band_days b LEFT OUTER JOIN jamroom_band_info j
ON (week(b.band_time) = week(from_unixtime(j.band_
WHERE j.band_active = 1
and j.band_time BETWEEN $date_from AND $date_to
GROUP by week