标签: sql-server sql-server-2005 sql-server-2008 sql-server-2000 sql-server-express
表tbl1
tbl1
字段id,name
id,name
id = 1 name = a
id = 1 name = w
id = 1 name = f
id = 2 name = c
id = 2 name = a
如何获得重复的场数。 id = 1,name = a ==> 2
答案 0 :(得分:2)
很简单
select id, name, count(*) from table group by id, name