SQL查询一批数据,怎么在最后一行增加个合计

如题所述

可以用联合查询(union all)来实现这个需求

例如:

select orderID,goodsID,quantity
from t1 union all
select null,null,sum(quantity)
from t1;
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答