Skip to content

Instantly share code, notes, and snippets.

@rchardptrsn
Created April 17, 2022 16:31
Show Gist options
  • Save rchardptrsn/55d3583a8d0e7ae93e3d088201b4ceb8 to your computer and use it in GitHub Desktop.
Save rchardptrsn/55d3583a8d0e7ae93e3d088201b4ceb8 to your computer and use it in GitHub Desktop.
county totals with geom.
SELECT f.county, f.well_count, co.geom -- pgAdmin will recognize co.geom
FROM ( -- subquery to get totals by county
SELECT county, COUNT(county) well_count
FROM fracking
GROUP BY county
) f
LEFT JOIN co_counties co -- all from f, matching from co
ON f.county = co.county
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment