$test = "select s.student_id, s.lastname, sum(p.amount)as Total, count(s.student_id),
e.VALIDATEDDATE from student s, enroll e, payment p
where s.student_id = e.student_id and s.student_id = p.student_id
and e.VALIDATEDDATE is not null group by s.student_id, e.VALIDATEDDATE, s.lastname;"
$resut
=我希望将最高金额显示为最大值
答案 0 :(得分:0)
你可以尝试使用类似的东西
select s.student_id, s.lastname, sum(p.amount)as Total, count(s.student_id),
e.VALIDATEDDATE from student s, enroll e, payment p
where s.student_id = e.student_id and s.student_id = p.student_id
and e.VALIDATEDDATE is not null group by s.student_id, e.VALIDATEDDATE, s.lastname ORDER BY sum(p.amount) desc