标签: sql sql-server-2008 aggregate-functions
我有一个包含st_name和id列的表格。我需要计算st_name和按st_name分组。我该怎么做?
st_name
id
答案 0 :(得分:0)
select st_name, count(*) as grp_cnt, (select count(distinct st_name) from your_table) as st_cnt from your_table group by st_name