表A:
ID ,PRICE
001,2.8
002,3.2
003,2.5
004,3.6
005,5.8
007,10.5
008,5.0
调整PRICE,大于5的下调30%,小于等于5的上调20%,sql语句该怎么写?一条SQL语句不知道怎么实现,分开写就更麻烦了。
ID ,PRICE
001,2.8
002,3.2
003,2.5
004,3.6
005,5.8
007,10.5
008,5.0
调整PRICE,大于5的下调30%,小于等于5的上调20%,sql语句该怎么写?一条SQL语句不知道怎么实现,分开写就更麻烦了。
set price=price*case when price>5 then 0.7
else 0.8 end
update tb
set price=price*case when price>5 then 0.7
else 1.2 end
是上调20%。