我正在尝试更新一列中的多个值
I am trying to update multiple values in one column
这是问题:
-如果phone的价格低于R8000,则涨价R100
-如果 phone 的价格为 R8000 或以上,则 reduction/decrease 在 phone.
的原始售价基础上加价 10%
这是我试过的:
UPDATE tblPhoneDetails
SET CellPhone_UnitPrice = CellPhone_UnitPrice - 100
WHERE (CellPhone_UnitPrice < '8000'),
SET CellPhone_UnitPrice = CellPhone_UnitPrice - CellPhone_UnitPrice * 0.1
WHERE (CellPhone_UnitPrice > '8000')
我想你想要一个 case
表达式:
update tblphonedetails
set cellphone_unitprice = case
when cellphone_unitprice < 8000 then cellphone_unitprice - 100
else cellphone_unitprice * 0.9
end
这是问题:
-如果phone的价格低于R8000,则涨价R100 -如果 phone 的价格为 R8000 或以上,则 reduction/decrease 在 phone.
的原始售价基础上加价 10%这是我试过的:
UPDATE tblPhoneDetails
SET CellPhone_UnitPrice = CellPhone_UnitPrice - 100
WHERE (CellPhone_UnitPrice < '8000'),
SET CellPhone_UnitPrice = CellPhone_UnitPrice - CellPhone_UnitPrice * 0.1
WHERE (CellPhone_UnitPrice > '8000')
我想你想要一个 case
表达式:
update tblphonedetails
set cellphone_unitprice = case
when cellphone_unitprice < 8000 then cellphone_unitprice - 100
else cellphone_unitprice * 0.9
end