-- 查询平均成绩大于等于 85 的所有学生的学号、姓名和平均成绩
SELECT s.Sid,s.Sname,avg FROM student AS s JOIN (SELECT Sid, AVG(score) AS avg FROM sc GROUP BY Sid HAVING avg >=85) AS k ON s.Sid = k.Sid;
原文地址:https://www.cnblogs.com/zunfengliu/p/12199051.html
时间: 2024-10-10 14:39:57