0

global $wpdb;
 $SQLquery = "
    SELECT $wpdb->posts.ID FROM $wpdb->posts 
    LEFT JOIN $wpdb->term_relationships 
    ON ( $wpdb->posts.ID = $wpdb->term_relationships.object_id  ) 
    WHERE 1=1 
    AND ( $wpdb->term_relationships.term_taxonomy_id IN ( 	90127 ) ) 
    AND $wpdb->posts.post_type = 'post' 
    GROUP BY $wpdb->posts.ID
";
//echo $SQLquery;
$SQLqueryCount = $wpdb->get_results($SQLquery,ARRAY_A);
echo 'Original Table : '.count($SQLqueryCount).'<br><br>';
 $SQLqueryn = "
    SELECT wp_posts_clone.ID FROM wp_posts_clone LEFT JOIN wp_term_relationships_clone ON ( wp_posts_clone.ID = wp_term_relationships_clone.object_id ) WHERE 1=1 AND ( wp_term_relationships_clone.term_taxonomy_id IN ( 90127) ) AND wp_posts_clone.post_type = 'post' GROUP BY wp_posts_clone.ID
";
//echo $SQLqueryn;
$SQLqueryCountn = $wpdb->get_results($SQLqueryn,ARRAY_A);
echo 'Clone Table : '.count($SQLqueryCountn);

Jagdish Sarma Asked question February 9, 2023
Add a Comment