这是我的mysql声明:
select distinct(prodname),
sum(qty)
from tblordertrail
group by prodname;
结果是:
+----------+------------+
| prodname | sum(qty) |
+----------+------------+
| product1 | 27 |
| product2 | 77 |
| product3 | 198 |
| product4 | 34 |
+----------+------------+
但我想要的结果是:
+----------+------------+
| prodname | sum(qty) |
+----------+------------+
| product3 | 198 |
| product2 | 77 |
| product4 | 34 |
| product1 | 27 |
+----------+------------+
先谢谢我的同事们。