1
Station_Name | ID
------------------
santo        |  1
berlin       |  2
fero         |  3
------------------

表名 Training_detail

需要通过 id 获取 Station_Name Group 的计数。 已尝试查询来实现这一点。但出错了如何实现这一点。提前致谢。

4

2 回答 2

0

尝试这个

SELECT count(*) Count, Station_Name from Training_detail group by Station_Name
于 2013-10-28T11:40:39.047 回答
0

这是代码:

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
于 2013-10-28T11:41:36.673 回答