SELECT SUM(if(gy is null,quan,gy)) FROM `表名` WHERE time='20220214' AND rjid='DTH' AND name='前腿瘦肉' AND dm<>''

查询 计数(if(判断条件,为真执行,为假执行)) FROM jl WHERE 查询条件

SELECT SUM(if(判断列值,为真取,为假取)) FROM `表名` WHERE time='20220214' AND rjid='DTH' AND name='前腿瘦肉' AND dm<>''
Last modification:February 14, 2022
反正也没人会打赏