How to add processing results to the new column based on the existing table?

SELECT c.`id` , ( SELECT COUNT( * ) FROM `items_comments` WHERE `reply_to` = c.id ) AS сount FROM `items_comments` c WHERE c.`reply_to` =0 

The query is executed, but how to add the result to the column?

In this example, I created in items_comments table a column reply_to_count , into which the results should fall.

    1 answer 1

    1. We find all the comments that do not respond to anyone.
    2. We calculate how many answers each of them has.
    3. Remember the result.
     UPDATE `items_comments` c1 SET `reply_to_count` = (SELECT COUNT (*) FROM `items_comments` c2 WHERE c2.`reply_to` = c1.`id`) WHERE c1.`reply_to` = 0