select * from a t1 where exists (select 1 from a t2 where t2.id=t1.id and t2..name=t1.name)
没明白你的需求,SELECT * FROM a WHERE id = 1 AND name = '1'
--通过子查询,取到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 a.* from a inner join b on a.id=b.id and a.name=b.name
select * from a as A
where exists (select 1 from a where A.id=id and A.name=name)
select * from a t1
where exists (select 1 from a t2 where t2.id=t1.id and t2..name=t1.name)
--通过子查询,取到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'
from 表a
where
id=1 and name=1
select *
from表 a inner
join b on a.id=b.id and a.name=b.name