Scratching my head, how to get the the count, including if there's zero.
For example, I have 2 tables, Event that has a ket to table Types. How can I list all event types, with the count in each type?
SELECT Types.name, COUNT(Events.event_id) AS Amount
FROM Types, Events
ORDER BY Types.name
GROUP BY Events.event_id
Returns
++++++++++++++++++++++++++
+ Types.name + Amount +
+------------------------+
+ Call + 3 +
+ Dinner + 2 +
+ Lunch + 1 +
+ Meeting + 2 +
++++++++++++++++++++++++++
How can I have it also return the Types.name that have zero?
like
++++++++++++++++++++++++++
+ Types.name + Amount +
+------------------------+
[b]+ Birthday + 0 +[/b] <------ <----
+ Call + 3 +
+ Dinner + 2 +
+ Lunch + 1 +
+ Meeting + 2 +
++++++++++++++++++++++++++
Table Events
++++++++++++++++++++++++++
+ event_id + fk_type +
+------------------------+
+ 1 + 5 +
+ 2 + 3 +
+ 3 + 3 +
+ 4 + 4 +
+ 5 + 2 +
+ 6 + 2 +
+ 7 + 2 +
+ 8 + 5 +
++++++++++++++++++++++++++
Table Types
+++++++++++++++++++++++++
+ type_id + name +
+-----------------------+
+ 1 + Birthday +
+ 2 + Call +
+ 3 + Dinner +
+ 4 + Lunch +
+ 5 + Meeting +
+++++++++++++++++++++++++
Thank you very much.