5. Geospatial Functions : Union
 
Share this page                  
Union
UNION(g1 Geometry, g2 Geometry)
Alias: ST_UNION
Returns an object that contains every point in g1 and/or g2.
Result type: geometry
Example:
SELECT ASTEXT(UNION(POLYFROMTEXT('polygon((0 0,10 0,5 10,0 0))'),POLYFROMTEXT('polygon((0 10,5 10,2.5 0,0 10))')));
--------------------------------
col1
--------------------------------
POLYGON ((2.5 0, 0 0, 1.6666666666666667 3.333333333333333, 0 10, 5 10, 10 0, 2.5 0))
--------------------------------