refactor query to 3 way join
This commit is contained in:
parent
ac82c33bcb
commit
d73a526835
@ -192,28 +192,14 @@ function getDataConfig(tileset: string): DataConfig {
|
|||||||
JOIN
|
JOIN
|
||||||
geometries AS g
|
geometries AS g
|
||||||
ON d.geometry_id = g.geometry_id
|
ON d.geometry_id = g.geometry_id
|
||||||
|
JOIN
|
||||||
|
buildings AS b
|
||||||
|
ON d.geometry_id = b.geometry_id
|
||||||
|
WHERE
|
||||||
|
b.latest_demolish_date IS NULL
|
||||||
) AS data
|
) AS data
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if(table == 'buildings') {
|
|
||||||
|
|
||||||
const query = `(
|
|
||||||
SELECT
|
|
||||||
d.*,
|
|
||||||
g.geometry_geom
|
|
||||||
FROM (
|
|
||||||
${table}
|
|
||||||
) AS d
|
|
||||||
JOIN
|
|
||||||
geometries AS g
|
|
||||||
ON d.geometry_id = g.geometry_id
|
|
||||||
WHERE
|
|
||||||
d.latest_demolish_date IS NULL
|
|
||||||
) AS data
|
|
||||||
`;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
geometry_field: GEOMETRY_FIELD,
|
geometry_field: GEOMETRY_FIELD,
|
||||||
table: query
|
table: query
|
||||||
|
Loading…
Reference in New Issue
Block a user