selectp_id,count(s_id)fromtablewherep_id=:p_id(这个就是父节点的ID)groupbyp_id或者查出所有父节点的:selectp_id,count(s_id)fromtablegroupbyp_id