Skip to content

Instantly share code, notes, and snippets.

@James-McNeill
Created June 26, 2021 09:24
Show Gist options
  • Save James-McNeill/e90cf841162358b6e2f600d800baff8f to your computer and use it in GitHub Desktop.
Save James-McNeill/e90cf841162358b6e2f600d800baff8f to your computer and use it in GitHub Desktop.
-- Use union to combine the results from two or more select statements (only distinct values)
SELECT county, station, max(temp) as max_temp, min(temp) as min_temp
FROM hrly_Irish_weather
WHERE county = "Cork"
GROUP BY county, station
UNION
SELECT county, station, max(temp) as max_temp, min(temp) as min_temp
FROM hrly_Irish_weather
WHERE county = "Galway"
GROUP BY county, station;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment