这里我使用内部联接返回每个区域中的站点数。
我得到了结果
Zone (No column name)
MIDDLESEX 4
如何标记上面的列?
我尝试将作为'No_of_Stations'进行内连接
这是我的代码。
select
dbo.FindIntersectingZone(location) as 'Zone',
count(*)
from
londonStations
inner join [planning_districts_2008_updated] on [planning_districts_2008_updated] .geom.STIntersects(stations.location) = 1
group by
dbo.FindIntersectingZone(location)
答案 0 :(得分:2)
只需在COUNT(*)之后添加别名:
SELECT dbo.FindIntersectingZone(location) AS 'Zone', count(*) AS No_of_Stations
FROM londonStations
INNER JOIN [planning_districts_2008_updated]
ON [planning_districts_2008_updated].geom.STIntersects(stations.location) = 1
GROUP BY dbo.FindIntersectingZone(location)
答案 1 :(得分:0)
要在查询结果集中标记列,您希望使用别名 - 使用关键字AS