cartodb在同一层上制作两次

时间:2015-10-05 12:13:06

标签: sql cartodb

我有一个带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

在同一层上

1 个答案:

答案 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;