Hi,
How do I combine these two select statements into one query:
SELECT SUM( incidents ) AS fires, neighborhoods AS fire_neighborhoods
FROM (
SELECT *
FROM `fires_2009_incident_location`
UNION ALL SELECT *
FROM `fires_2008_incident_location`
UNION ALL SELECT *
FROM `fires_2007_incident_location`
UNION ALL SELECT *
FROM `fires_2006_incident_location`
) AS combo
GROUP BY fire_neighborhoods ORDER BY fires DESC
SELECT SUM( incidents ) AS adw, neighborhoods AS adw_neighborhoods
FROM (
SELECT *
FROM `adw_2009_incident_location`
UNION ALL SELECT *
FROM `adw_2008_incident_location`
UNION ALL SELECT *
FROM `adw_2007_incident_location`
UNION ALL SELECT *
FROM `adw_2006_incident_location`
) AS combo2
GROUP BY adw_neighborhoods ORDER BY adw DESC
So, I'd like the query to return, something like:
fire_neighborhoods fires adw_neighborhoods adw
xyzNeighborhood 6 abcNeighborhood 22
jklNeighborhood 3 tuvNeighborhood 40
I want to simply combine the results of the two queries above. The two queries are independent of each other. The results of one doesn't effect the results of the other query. I simply need a way to slam the two results together into one.
If anyone has any advice, please let me know.
Thank you.
-Laxmidi