WordPress.org

Forums

dbview
[resolved] Sintax problem (2 posts)

  1. lododicesimo
    Member
    Posted 1 year ago #

    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/

  2. john ackers
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • dbview
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic