Eventhosts – containing the three regular hosts and an "other" field (if someone is replacing them) or edit: being a guest host (in addition to the regulars)
eventid | host (SET[Steve,Tim,Brian,other])
-------------------------------------------
1 | Steve
2 | Tim
3 | Brian
4 | Brian
5 | other
6 | other
Event
id | other | name etc.
----------------------
1 | | …
2 | | …
3 | | …
4 | Billy | …
5 | Billy | …
6 | Irwin | …
This query:
SELECT h.host, COUNT(*) AS hostcount
FROM host AS h
LEFT OUTER JOIN event AS e ON h.eventid = e.id
GROUP BY h.host
Returns:
Steve | 1
Tim | 1
Brian | 2
other | 2
I want it to return:
Steve | 1
Tim | 1
Brian | 2
Billy | 1
Irwin | 1
OR:
Steve | | 1
Tim | | 1
Brian | | 2
other | Billy | 1
other | Irwin | 1
And not:
Steve | | 1
Tim | | 1
Brian | | 1
Brian | Billy | 1
other | Billy | 1
other | Irwin | 1
Can someone tell me how I can achieve this or point me in a direction?