在SQL情况下,多个条件比其他条件多

嗨,我有下面的代码,如果您要在下面看到A.PP数量的总和,我会提及> = 2和> = 5 如果大于2,则必须乘以1000,大于15则乘以1500

select *,
case 


     when b.SCode = 0202 and b.Itcoded = '37.01.123.0001'
     and b.MONTHOFDISC = 'march'  then
    case
        when sum(case when b.SCode = 0202 and b.Itcoded = '37.01.123.0001' and b.MONTHOFDISC = 'march'
        then b.appqty end) over()   >= 2  then (b.AppQty * 1000)
    end

    when b.SCode = 0202 and b.Itcoded = '37.01.123.0001'
     and b.MONTHOFDISC = 'march'  then
    case
        when sum(case when b.SCode = 0202 and b.Itcoded = '37.01.123.0001' and b.MONTHOFDISC = 'march'
        then b.appqty end) over()   >= 5  then (b.AppQty * 1500)
    end

      end     DiscAmount

我想将b.appqty的值相乘,但它只能与1000相乘,请帮助此操作1500的乘法不起作用

评论