Reputation: 433
what's wrong with this query?
UPDATE `order` SET `total_no_vat` = IF(`total` IS NULL,NULL,(`total`/(1.10)));
I get an error that I cannot interpret:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') )' at line 1
any clue?
Upvotes: 0
Views: 26
Reputation: 72165
You can simply do:
UPDATE `order` SET `total_no_vat` = `total`/(1.10);
If total
is NULL
then total/(1.10)
evaluates to NULL
.
Upvotes: 1