Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 MySQL 数据库中有一个列,其中包含以下值:值 A [下一行] 值 B [下一行] 值 C [下一行] 值 A [下一行] 值 B [下一行] 值 C。我想要每个相似的值要组合和出现的次数,如:2(x)值A,2(x)值B,2(x)值C。谢谢!
听起来你想要一个直方图。您应该执行如下查询:
select value, count(*) as count from table group by value
这是一个演示数据库查询的 SQLFiddle