34,587
社区成员
发帖
与我相关
我的任务
分享
--通过子查询,取到group 的数据,再关联原表。
select *
From t_gm_scoreTotalAnalysis a
join (select classType,subjectId,MAX(averageScore)averageScore
from t_gm_scoreTotalAnalysis
where kslc='1'
group by classType,subjectId) b
on a.classType=b.classType and a.subjectId=b.subjectId and a.averageScore=b.averageScore
where kslc='1'
SELECT * FROM a WHERE id = 1 AND name = '1'
select * from a t1
where exists (select 1 from a t2 where t2.id=t1.id and t2..name=t1.name)
select * from a as A
where exists (select 1 from a where A.id=id and A.name=name)