-1

我在 SQL Server 2008 中有一个表,其中有一列products:示例行将是

product1
product1
product1
product2
product2
product3

我想从表中获取每个不同的product: ( product1=3,product2=2,product3=1) 的计数。我该如何查询这个?

4

1 回答 1

2
select [column name],count(*) from [table name] group by [column name]
于 2013-02-21T05:35:12.200 回答