the.s.brom
the.s.brom

Reputation: 95

Where's the syntax error in this update / join?

UPDATE P
SET P.post_type = 'banner-slide'
FROM `berwickr_wordpress.wp_posts` AS P
INNER JOIN berwickr_wordpress.wp_term_relationships AS T
ON P.ID = T.object_id
WHERE T.term_taxonomy_id = 3

Getting this error:

 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM berwickr_wordpress.wp_posts AS P INNER JOIN berwickr_wordpress.wp_term_rel' at line 3

Where's the snytax errors?

Upvotes: 0

Views: 48

Answers (1)

Amadan
Amadan

Reputation: 198436

UPDATE does not use FROM. Try this:

UPDATE berwickr_wordpress.wp_posts AS P
  INNER JOIN berwickr_wordpress.wp_term_relationships AS T
    ON P.ID = T.object_id
SET P.post_type = 'banner-slide'
WHERE T.term_taxonomy_id = 3

EDIT: extra OP backticks (*_*)

Upvotes: 1

Related Questions