Station_Name | ID
------------------
santo | 1
berlin | 2
fero | 3
------------------
表名 Training_detail
需要通过 id 获取 Station_Name Group 的计数。 已尝试查询来实现这一点。但出错了如何实现这一点。提前致谢。
Station_Name | ID
------------------
santo | 1
berlin | 2
fero | 3
------------------
表名 Training_detail
需要通过 id 获取 Station_Name Group 的计数。 已尝试查询来实现这一点。但出错了如何实现这一点。提前致谢。
尝试这个
SELECT count(*) Count, Station_Name from Training_detail group by Station_Name
这是代码:
WITH S AS (SELECT COUNT(Station_Name) as count,ID
FROM Training_detail
GROUP BY ID)
SELECT S.*,T.Station_Name
from s , Training_detail t
where T.ID=S.ID