Reputation: 515
I have a table user_has_alerts (userID, alertID, dateAlerted) and i'm trying to update all NULL values in dateAlerted field for a given user to the current date. Any help would be much appreciated.
Upvotes: 0
Views: 208
Reputation: 3573
UPDATE user_has_alerts SET dateAlerted = CURDATE()
WHERE userID = X AND dateAlerted IS NULL
Upvotes: 2
Reputation: 21449
UPDATE `user_has_alerts` SET `dateAlerted` = NOW() WHERE `dateAlerted` IS NULL AND userID = 1
Upvotes: 1