有两张表,TM1是本次的考试成绩,TM2是培优报送表,不管AAA和DDD考试多少分,因为他俩是培优报送,所以分数就该是100这种的sql应该咋写
select w.id,w.name,w.class, case when w.name=w.name1 then 100 else w.code end as code1 from
(select a.id,a.name,a.class,a.code,b.name as name1 from TM1 a
left join TM2 b on a.id=b.id) w
select A.id,A.name,A.class ,
case when B.id is not NULL then '100' else then A.code end
from TM1 A
left join TM2 B on A.id=B.id