sql 以某个字段分组,另一个字段为参加比较的列,取得前n项的值

假设表A有三个字段

{

  id int;

  subject varchar(20);

  socre int;

}

语句为 select * from A  x where (select count(*) from A where subject=x.subject and score>=x.score   )<=15

原文地址:https://www.cnblogs.com/zuopy/p/7777461.html