SELECT * FROM ( --根据 tb表的name进行分组,根据年龄排序 SELECT * , ROW_NUMBER() OVER ( PARTITION BY name ORDER BY age DESC ) rid FROM tb ) AS t --取每个名字的前十个数据记录 WHERE rid <= 10