I am trying to create a horizontal bar chart using a UNION query:
SELECT 'Cyber Girls' AS section, COUNT(a.heatLevel) AS completed FROM picture a WHERE a.heatLevel > 0 UNION
SELECT 'CGUK' AS section, COUNT(b.heatLevel) AS completed FROM cgukpicture b WHERE b.heatLevel > 0 UNION
SELECT 'Playmate Portfolio' AS section, COUNT(c.heatLevel) AS completed FROM pmppicture c WHERE c.heatLevel > 0 UNION
SELECT 'CGXtra' AS section, COUNT(d.heatLevel) AS completed FROM cgepicture d WHERE d.heatLevel > 0 UNION
SELECT 'Celebrities' AS section, COUNT(e.heatLevel) AS completed FROM celebpicture e WHERE e.heatLevel > 0
and the results:
section completed
======= =========
Cyber Girls 999
CGUK 48
Playmate Portfolio 1
CGXtra 195
Celebrities 0
I am only getting a single bar called 'Cyber Girls' with the 999 completed. Why are the other bars missing?
I am typing the SQL directly into the SQL tab. When I view the SQL in the Query Designer tab it changes my SQL to:
SELECT
'Cyber Girls' AS `section`,
COUNT(heatLevel) AS completed
FROM picture AS a
WHERE heatLevel > 0
which is not what I want... the other 4 sections are missing. It looks like the chart is using this SQL instead of what I typed, whether I type it in directly or view it in the Query Designer.
How can I get the other bars that I want into my chart?
Thanks.