计数每行的SQL Server 2008表
问题描述:
我在SQL Server 2008中的表,其中有一种product
个柱:例如行会计数每行的SQL Server 2008表
product1
product1
product1
product2
product2
product3
我想每个不同product
的计数:(product1=3,product2=2,product3=1
)。我如何查询这个?
答
select [column name],count(*) from [table name] group by [column name]
+0
感谢。正是工作尼斯... – Binoop 2013-02-21 06:19:08
+2
Mr.Arun,如果它工作正常,至少欣赏谁给了的人工作回答! 如果你想要,你可以给他! – 2013-02-21 13:11:36
http://www.w3schools.com/sql/sql_func_count.asp – mikey 2013-02-21 05:33:14