我想根据select语句中的虚拟列在查询中设置where条件。
Range("E2").AutoFill Destination:=Range("E2:E440")
有可能吗?
答案 0 :(得分:3)
您可以直接指定:
select *,dbo.DictanceKM(cast(u.latitude as float),
@lat,cast(u.longitude as float),@long) as distance
from Table u
where dbo.DictanceKM(cast(u.latitude as float),
@lat,cast(u.longitude as float),@long)<10
或使用子查询:
SELECT *
FROM (select *,dbo.DictanceKM(cast(u.latitude as float),
@lat,cast(u.longitude as float),@long) as distance
from Table u) sub
WHERE distance < 10