I have a table with a column Time that stores a timestamp value, a column that stores a Name and a column that stores a Status.
I’m trying to find a query to update all entries before a given timestamp like this:
UPDATE `Table`
SET Status=1
WHERE Name='personname' AND 'Time'<'2012-12-23 18:00:00'
The query is valid but nothing changes.
When trying to show the results of the WHERE part there are no results.
What am I doing wrong?
You’re comparing the string literal
'Time':Try comparing the time column instead:
Or if you have to, surround it in backticks:
Live example at SQL Fiddle.