I have a similar problem, but I can't get the syntax correct. This refers to the following question:
I'm trying to merge multiple polygons into one (in this case, just the 5 NYC boroughs into a single polygon, but for now I'm trying to merge all of them). This doesn't seem to work, as the result is still separate polygons.
SELECT
counties_ny
, cartodb_id
, max(county) as county
, max(fips) as fips
, max(county_fip) as county_fip
, st_union(the_geom_webmercator) as the_geom_webmercator
FROM counties_ny
group by county, counties_ny.cartodb_id