用一条sql语句查询平均分大于60的id
表名record
字段如下:
id subject fenshu
1 语文 50
1 数学 50
2 物理 50
2 语文 50
3 化学 50
[解决办法]
select id from tbl group by id having avg(score)>60
[解决办法]
select * from (select max(ID) ID ,avg(fenshu) AvgFen from tb group by ID ) as tb1 where AvgFen>60
[解决办法]
select id from record group by id having avg(fenshu)>60