Trying to replace a field directly via MySQL

Home Forums Calendar Products Events Calendar PRO Trying to replace a field directly via MySQL

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #350952
    yvlaw11
    Participant

    Hi,
    I’m trying to create a SELECT statement to insert an image reference into all evetns with a particular ID and particular EventOrganizerID but I’m not getting anywhere. My SQL is as follows:
    SELECT * FROM wp_sopostmeta
    UPDATE meta_id->_thumbnail_id
    SET meta_id->_thumbnail_id = ‘91273’
    WHERE post_id = “91180” AND _EventOrganizerID = “245”;

    I keep getting errors like this:
    #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 ‘UPDATE _thumbnail_id SET meta_value = ‘91273’ WHERE post_id = “91180” AND ‘ at line 2

    #361379
    Barry
    Member

    Hi!

    I think you’d be better off with a straight UPDATE statement rather than trying to embedĀ it within a SELECT.

    The general form you are looking for is going to be something like this and you can find out more by looking through the MySQL docs:

    UPDATE database.wp_postmeta
    SET meta_value = "something"
    WHERE (
        post_id = 12345 AND
        meta_key = "_thumbnail_id"
    );

    I hope that helps!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Trying to replace a field directly via MySQL’ is closed to new replies.