cartodb在同一层做两次线

cartodb make line twice on the same layer

我有一个包含 a_route 和 b_route 的数据库。我想在所有 a_route 具有相同值的数据点和另一条具有相同 b_route 值的所有数据点之间划一条线。所以我想要:

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

在同一层

使用可以使用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;