如何在mysql查询中获取带有count的唯一products_sku
例如:testrsp(4),TS234(2),152427(11)
products_sku
testrsp
testrsp
testrsp
testrsp
TS234
TS234
152427
152427
152427
152427
152427
152427
152427
152427
152427
152RE
152RE
152RE
152RE
152RE
152427
152RE
2030C
18062007P
18062007P
18062007P
18062007P
18062007P
152427
509P
答案 0 :(得分:0)
尝试使用count和group的组合,如:
SELECT products_sku, COUNT(*)
FROM mytable
GROUP BY products_sku
答案 1 :(得分:0)
这是一个简单的group by
count
select products_sku, count(*) from `table` group by products_sku