Support » Plugin: dbview » Sintax problem

  • Resolved lododicesimo

    (@lododicesimo)


    Hello. I have a website with a custom post type (alunni).
    i have to rotate all the category one time a year..

    Like a Shift rotate of the category (they are 6)

    So i have find a sql code that move all the post that are in a category to another and works. so i have to do 5 command to move all post and hava the first category empty.

    the code i use is like:

    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ’10’ WHERE wp_term_relationships.term_taxonomy_id = 8 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);

    if i put all 5 code the plugin said that i have sintax error, so i have to do all the code one for one.. here is what i have to do:

    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ’10’ WHERE wp_term_relationships.term_taxonomy_id = 8 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);
    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ‘8’ WHERE wp_term_relationships.term_taxonomy_id = 7 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);
    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ‘7’ WHERE wp_term_relationships.term_taxonomy_id = 6 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);
    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ‘6’ WHERE wp_term_relationships.term_taxonomy_id = 5 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);
    UPDATE wp_term_relationships SET wp_term_relationships.term_taxonomy_id= ‘5’ WHERE wp_term_relationships.term_taxonomy_id = 4 AND EXISTS (SELECT * FROM wp_posts AS A1 WHERE A1.ID = wp_term_relationships.object_id AND A1.post_type = “alunni”);

    where is the error?
    thanks

    https://wordpress.org/plugins/dbview/

Viewing 1 replies (of 1 total)
  • Plugin Author john ackers

    (@john-ackers)

    dbview is only intended to display database data in a table. You can execute inserts, updates, and deletes but you can only execute one SQL statement in each dbview not five. Sorry.

Viewing 1 replies (of 1 total)
  • The topic ‘Sintax problem’ is closed to new replies.