Reputation: 3875
I have two tables joined by the foregin key 'ID':
table A has ID,MONTH,VOTES as well as table B ID,MONTH,OTHER_VOTES.
table A and table B as expected collect votes. Not all the time are there votes of both kinds.
I want to LEFT JOIN
B to A so that on months that OTHER_VOTES don't exist (none, empty) I would get 0 instead of an empty cell.
Is that possible?
Thanks!
Upvotes: 2
Views: 146
Reputation: 18870
It is indeed. Where you select the column, use IFNULL(OTHER_VOTES, 0)
.
Upvotes: 6