Thursday, 19 September 2013

How to update mysql cols with comparison

How to update mysql cols with comparison

I have this table:
+----------------+--------------+
| Field | Type |
+----------------+--------------+
| id | int(10) |
| confirm | int(5) |
| confirm_hold | int(5) |
| tmp | int(6) |
+----------------+--------------+
and have a some problem.
How can UPDATE some row. For example:
UPDATE `table` SET IF `tmp`>0 `confirm_hold`=123 ELSE `confirm`=123;
Thanks for all

No comments:

Post a Comment