MySQL Forums
Forum List  »  Newbie

Re: Return 0 for data with no matching values
Posted by: Peter Brawley
Date: March 20, 2015 11:55PM

Your left join is backwards.

select year(cal.date), count(b.birthdate)
from calendar c
left join birthdates b on c.date=b.date
group by year(cal.date);

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.