0
我試圖將總和值移到右邊而不是底部。只得到所有項目的小計
目前,我有這個疑問:
SELECT
if(product is NULL, 'Total', product) as Product,
total_items as Total,
SUM(total_items) as Subtotal
FROM items
WHERE inv = "ABC"
GROUP BY product
WITH ROLLUP
的這個輸出是:
| Product | Total | Subtotal |
| AB | 260 | 260 |
| DE | 66 | 66 |
| Total | 66 | 326 |
有沒有辦法我能做到這樣?
| Product | Total | Subtotal |
| AB | 260 | |
| DE | 66 | |
| | | 326 |
爲什麼不這樣做的MySQL – Sergey 2014-12-03 00:26:59
呀之外 - 我真的不彙總的粉絲 – Strawberry 2014-12-03 00:45:33