我在sql中非常糟糕,我的查询是
select * from car_wash where
(select ST_Within((select car_wash.lon_lat from car_wash),(select ST_Buffer(ST_GeomFromText('POINT(65.3 323.2)'),20)))) = true
AND car_wash.was_deleted=false;
但我知道它不正确,因为嵌套查询可以返回多于1列,如何修改此查询以使用where子句
答案 0 :(得分:0)
我不使用postgresql,但也许这样的工作:
select * from car_wash
where EXISTS (select ST_Within((select car_wash.lon_lat from car_wash),
(select ST_Buffer(ST_GeomFromText('POINT(65.3 323.2)'),20))) within
WHERE within = true)
AND car_wash.was_deleted=false;
如果它不起作用,我有一个变体,所以告诉我什么时候。
答案 1 :(得分:0)
select *
from car_wash cw
where
ST_Within (
cw.lon_lat,
ST_Buffer(ST_GeomFromText('POINT(65.3 323.2)'),20)
)
AND
not car_wash.was_deleted