有这样一道题,想了半天了都想不出来该怎么样查询最少3门科目,很惭愧,哪位大侠给解决下!下面附有图片
select t.* from test111 t where t.studentname in (
select t.studentname from test111 t where t.chengji > 90 group by t.studentname having count(*) > 2)
select * from table where name in (
select name from table where chengji > 90 group by name having count(1) > 3 )
在楼上的基础之上再加个chengji > 90 就对了。