我有一个带a_route和b_route的数据库。我想在a_route具有相同值的所有数据点和具有b_route相同值的所有datapoint的另一行之间建立一条线。所以我希望:
SELECT ST_MakeLine(the_geom) AS the_geom, a_route
FROM terminals
GROUP BY a_route
和
SELECT ST_MakeLine(the_geom) AS the_geom, b_route
FROM terminals
GROUP BY b_route
在同一层上
答案 0 :(得分:0)
使用可以使用UNION ALL
:
SELECT ST_MakeLine(the_geom) AS the_geom, a_route
FROM terminals
GROUP BY a_route
UNION ALL
SELECT ST_MakeLine(the_geom) AS the_geom, b_route
FROM terminals
GROUP BY b_route;