condition where a maximum value

select s.* from student s left join school sc on sc.scId = s.scId
LEFT JOIN (select MAX(scores),stu_id from achievement group by stu_id )a2 ON a2.stu_id = s.id
where s.id = '0000001';

Discover a school by a student performance of the best one

Guess you like

Origin www.cnblogs.com/zzlcome/p/11128856.html