I want to check how many members each user recommended? What members are there?
As shown in the picture
I want to check how many members each user recommended? What members are there?
As shown in the picture
<code>select id,user_name,(select count(1) from user where recommend_id=u.id )recommend_count from user u</code>
Use aliases to turn this table into two tables and just associate them