当前位置:Gxlcms > 数据库问题 > SQL技巧之分类汇总

SQL技巧之分类汇总

时间:2021-07-01 10:21:17 帮助过:2人阅读

a as( select type,sum(num) as num from foods group by type), b as( select type,(case when type=小麦 then 1.2 when type=玉米 then 1.5 end)*num as price from a) select sum(price) as result from b

 

SQL技巧之分类汇总

标签:

人气教程排行