Syntax\n------\n\nST_Collect(g)\n\nDescription\n-----------\n\nST_Collect is an aggregate function that can also be used as a window function.\n\nGiven multiple geometries, returns the aggregation of the distinct geometry arguments. This function also supports the DISTINCT option. If DISTINCT is used, it returns the aggregation of the distinct geometry arguments.\n\nThe resulting value type is chosen using the following policy:\n\n If all arguments are Point values, the result is a MultiPoint value.\n If all arguments are LineString values, the result is a MultiLineString value.\n If all arguments are Polygon values, the result is a MultiPolygon value.\n Otherwise, the result is a GeometryCollection value.\n\nIf there are multiple geometry arguments and those arguments are in the same spatial reference system (SRS), the return value is in that SRS. If those arguments are not in the same SRS, an ER_GIS_DIFFERENT_SRIDS_AGGREGATION error occurs.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 ( running_number INTEGER NOT NULL\n  AUTO_INCREMENT, grouping_condition INTEGER, location GEOMETRY , PRIMARY KEY (\n  running_number));\n\nINSERT INTO t1 ( grouping_condition, location ) VALUES\n  ( 0,ST_GEOMFROMTEXT('POINT(0 0)',4326)),\n  ( 1,ST_GEOMFROMTEXT('POINT(0 0)',4326)),\n  ( 0,ST_GEOMFROMTEXT('POINT(1 0)',4326)),\n  ( 1,ST_GEOMFROMTEXT('POINT(2 0)',4326)),\n  ( 0,ST_GEOMFROMTEXT('POINT(3 0)',4326));\n\nSELECT ST_EQUALS( (SELECT ST_COLLECT( location ) AS t FROM t1), \n  ST_GEOMFROMTEXT('MULTIPOINT(0 0,0 0,1 0,2 0,3 0) ',4326)) AS equals;\n+--------+\n| equals |\n+--------+\n|      1 |\n+--------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_collect