Sunday 29 September 2013

MySQL - Update field statement query/error

MySQL - Update field statement query/error

The below statement returns the results I want to change perfectly
"Showing rows 0 - 29 ( 2,018 total, Query took 0.0781 sec)" :
SELECT * FROM wp_posts WHERE ID IN
(SELECT post_id FROM wp_postmeta WHERE (meta_key = 'expires') AND
(meta_value <= NOW() - INTERVAL 1 DAY) AND (meta_value IS NOT NULL));
However the below returns an error "#1292 - Truncated incorrect datetime
value: ''", when I try and update that result sets 'post_status' field ...
Where is the error in my 2nd statements syntax please (below) ?
UPDATE wp_posts SET post_status='draft' WHERE ID IN
(SELECT post_id FROM wp_postmeta WHERE (meta_key = 'expires') AND
(meta_value <= NOW() - INTERVAL 1 DAY) AND (meta_value IS NOT NULL));
Thanks.

No comments:

Post a Comment