我有一张table
我有以下查询的结果集
select ss.Quantity as Qty ,ss.Item , ss.ES_ServiceStart as Time, fr.functionRoom from tblServiceSummary ss
join servdesc sd on ss.Service_time =sd.ServDescID
join funct fn on fn.FunctID = ss.FunctionID
join tbl_functionRoom fr on fr.id=fn.EvtID
where fn.StartDate between '2018-09-19' and '2018-09-19'
and ss.Item != ''
order by ss.Item
这样地
我想表现得像
表示行数据和行的总和。
只是想知道这在mysql中是可能的吗?我无法实现与小组按功能划分。
我找到的唯一相关的东西是汇总函数。
我试过了
像这样的查询
SELECT Quantity, Item, count(Quantity) AS sumoption
FROM tblServiceSummary
GROUP BY Quantity WITH ROLLUP
但这给了我这样的结果
也试过了
SELECT Quantity, Item, count(Quantity) AS sumoption
FROM tblServiceSummary
GROUP BY Quantity WITH ROLLUP
请建议
1条答案
按热度按时间kqhtkvqz1#
您可以使用“sum-group by item”选择并相应地排序来创建一个并集。