php - How to get count children of users -


i want count of chidren. try query not work table colums

id, father_id , name

select id parent_id , father_id ,name, count(select * users father_id = parent_id) child         users 

use correlated sub-query count:

select id parent_id , father_id ,name, (select count(*) users u2                                            u2.father_id = u1.id) child users u1 

Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

android - How to read a column value in parse.com without accessing an object or a pointer -

timer - Java TimerTask cancel -