Table Person has columns id and parent_id.
I need get a table with columns id and children_count. How can it be performed? Why I can not write something like this? :
SELECT
id, count(parent_id) AS children_count
FROM
Person
GROUP BY
parent_id;