一个面试题 ,请会SQL的高手帮下忙

2024-12-27 04:55:35
推荐回答(5个)
回答1:

select max(FCLASS),FSCORE from table
where FCLASS in (select FCLASS,count(FID) from table having count(FID)>30 group by FCLASS)

回答2:

楼上的两条语句都无法运行,原因是FCLASS in (select FCLASS,count(FID) from table having count(FID)>30 group by FCLASS),fclass是一个返回值,但是括号中的字段是两个,所以会执行不成功,有语法问题

select a.FCLASS,max(a.FSSCORE) from table a, (select FCLASS,count(FID)
from table
having count(FID)>30
group by FCLASS) b
where a.FCLASS=b.FCLASS
group by a.FCLASS

回答3:

帮muqiao520 补充一下,少了个group by. ^_^

select max(FCLASS),FSCORE
from
table
where
FCLASS in (select FCLASS,count(FID)
from table
having count(FID)>30
group by FCLASS)
group by FCLASS

回答4:

select FCLASS,FSSCORE from table where count(FID)>30 GOURP BY FSSCORE;

回答5:

Select FCLASS,Max(FSSCORE) From Table
Group By FCLASS Having Count(FID)>30

好像就这样就行了。