📅  最后修改于: 2022-03-11 15:05:30.740000             🧑  作者: Mango
select top 10 p.Nombre, p.Apellidos, (SELECT COUNT(*) FROM Personas ps WHERE PS.ParentCode LIKE '%' + CONVERT(VARCHAR, p.id) + '-%' ) Total
from personas p
ORDER BY Total desc