Reputation: 1
IN MS-ACCESS:
I have a table RESTAURANTS
that has a column Price
I want to change the prices in the table based on these conditions:
if the price is less than 25, add 10 to that price, if the price is 25 or over, I want to subtract 10 from that price. This is the syntax I used:
UPDATE RESTAURANTS
SET Price = IIF(Price <25, Price= Price +10, Price = Price -10)
PROBLEM: Instead of changing the prices, I deleted them all
Upvotes: 0
Views: 349
Reputation: 10184
Try:
UPDATE RESTAURANTS SET Price = IIF(Price <25, Price +10, Price -10)
What you did is supply the full expression as the argument, which I think ended up being evaluated as a logical expression (always false). The result of the IIF is the amount you wish to increment the original price, so that's what you want to return. Hope this is helpful.
Upvotes: 1