通过SQL更新多个帖子的wordpress标签

Here's what I want to do:

  1. Find 10 posts that do not have any tags and whose comment count = 0
  2. Tag those 10 posts with a tag "tag_name"

With query_posts, the first part should look something like this I think:

<?php
query_posts(array(
    'post_type' => 'post',
    'tag' => "",
    'paged' => $paged,
    'comment_count' => '0',
    'posts_per_page' => '10',
)); ?>

I have no idea what the second part should look like, but I think the whole thing needs to be in SQL form in order to be able to update the tags for the found posts.

Any help would be much appreciated!

$tag_name = 'your tag';

$posts = new WP_Query( array(
    'post_type' => 'post',
    'paged' => $paged,
    'comment_count' => '0',
    'posts_per_page' => '10',
));

if( $posts->have_posts() ): while( $posts->have_posts() ): $posts->the_post();

    wp_set_post_tags( $post->ID, $tag_name );

endwhile; endif; wp_reset_query();