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.
我有一个有 2 列的简单表格
item | num foo | 32 foo | 22 bar | 12 baz | 3 baz | 2 bar | 25
如果项目具有相同的值,我需要获得 num 的总和, 因此结果如下
item | num foo | 54 bar | 37 baz | 5
我可以通过 PHP 做到这一点,但我不知道它是否可以通过直接查询来 完成
item | num foo | 54
select item,sum(num) as num from yourTable group by item