select mytable.id,mytable.descript,step1.CountChildren from mytable ; inner join ; (select parent_id , count(*) as CountChildren from mytable group by parent_id ) step1 ; on mytable.id = step1.parent_id