Reputation: 15269
I got an field named last
in MySQL, it has an attribute: datetime
so the last
is displaying like this: 2012-01-27 20:21:35
, now I need to update rows with datetime
bigger than 2012-01-20 20:00:00
so the query should look similar to:
UPDATE `player`
SET `hh` = `hh` + 1000
WHERE `last` > '2012-01-20 20:00:00'
Ofc. the above example won't work, but its just a sketch on how it should look like & what I want to reach.
How it can be done in MySQL query? Or maybe I'll have to use other language for this task?
Upvotes: 0
Views: 64
Reputation:
Use unix_timestamp
UPDATE `player`
SET `hh` = `hh` + 1000
WHERE unix_timestamp(`last`) > unix_timestamp('2012-01-20 20:00:00')
Upvotes: 1