Reputation: 928
This should be simple but I am missing something. The following is supposed to look in the game table and set winner_id to 9999 where the winner_id
is NULL.
The query executes none of the records gets updated with 9999. The winner_id column is set to varchar 10.
UPDATE game
SET winner_id = 9999
WHERE winner_id = NULL LIMIT 1";
Upvotes: 0
Views: 53
Reputation: 204746
You have to use IS
when comparing to NULL
instead of =
UPDATE game
SET winner_id = 9999
WHERE winner_id IS NULL
LIMIT 1
Because comparing to null
results in unknown
with =
.
Upvotes: 0