sql 中的除0零運算


SELECT sum((case   WHEN sfa28<>0 THEN  sfa06/sfa28   else 0 end )*tc_ecr07) as goods_rate ,ta_sfa01,ta_sfa02   
 FROM  sfa_file     
 JOIN sfb_file ON (sfb01=sfa01)    
LEFT JOIN tc_ecr_file ON (tc_ecr01=sfb05 and tc_ecr02=sfb06 and ta_sfa01=tc_ecr03 and  ta_sfa02=tc_ecr04)    
 where sfa01='5101-081200088'    GROUP BY sfa01,ta_sfa01,ta_sfa02  ;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章