用group by关键字, 某一字段值相同的分一组,不相同的分一组的SQL语句怎么写?
发布网友
发布时间:2022-06-02 15:44
我来回答
共2个回答
热心网友
时间:2023-11-10 06:51
不能用UNION ALL么??
SELECT '熟料’ as 货物名称,count(truckno) as 车数,sum(gross) as 毛重,sum(tare) as 皮重,sum(net) as 净重 from main
where goods='熟料’
union all
SELECT '非孰料'as 货物名称,count(truckno) as 车数,sum(gross) as 毛重,sum(tare) as 皮重,sum(net) as 净重 from main
where goods<>'熟料’
热心网友
时间:2023-11-10 06:51
union all...
我回去测试下。。我还没有遇见这种。。
初学者好多小技巧都不晓得。。