有没有办法优化以下查询。
以下查询工作正常但我多次使用 where 和来自条件。
查询:
SELECT st_astext(st_line_substring(
(SELECT st_linemerge(geom)
FROM geom_line
WHERE i_project = $id),
(SELECT $bas/st_length(geom)
FROM geom_line
WHERE i_project = $id),
(SELECT $son/st_length(geom)
FROM geom_line
WHERE i_project = $id) ))
FROM geom_line
WHERE i_project = $id;
的问候。 !
答案 0 :(得分:0)
我叮叮当然可以这么试试
SELECT st_astext(st_line_substring( st_linemerge(geom) ,
$bas/st_length(geom),
$son/st_length(geom) ))
FROM geom_line
WHERE i_project = $id;