select distinct
case
when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2)
else (
select distinct if(b.exam_batch is null,substring(a.admission_card,5,2),substring(a.admission_card,1,2)) as pc
from t_exam_score a,t_apply_info b where a.admission_card=b.admission_card and a.exam_type_id=2
)
end as pc
from t_exam_score a这部分 when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2) 求出来的结果是 14、15、16
else里面求出来的结果是15、16执行查询语句报错Subquery returns more than 1 row 1,求大神们告知怎么解决
case
when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2)
else (
select distinct if(b.exam_batch is null,substring(a.admission_card,5,2),substring(a.admission_card,1,2)) as pc
from t_exam_score a,t_apply_info b where a.admission_card=b.admission_card and a.exam_type_id=2
)
end as pc
from t_exam_score a这部分 when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2) 求出来的结果是 14、15、16
else里面求出来的结果是15、16执行查询语句报错Subquery returns more than 1 row 1,求大神们告知怎么解决
select distinct if(b.exam_batch is null,substring(a.admission_card,5,2),substring(a.admission_card,1,2)) as pc
from t_exam_score a,t_apply_info b where a.admission_card=b.admission_card and a.exam_type_id=2
select distinct
case
when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2)
when b.exam_batch is null and a.exam_type_id=2 then substring(a.admission_card,5,2)
when b.exam_batch is not null and a.exam_type_id=2 then substring(a.admission_card,1,2)
end as '批次'
from t_exam_score a left join t_apply_info b on a.admission_card = b.admission_card
select distinct
case
when a.exam_type_id=1 or a.exam_type_id=5 then substring(a.admission_card,7,2)
when a.exam_type_id=3 then substring(a.admission_card,8,2)
when a.exam_type_id=4 then substring(a.admission_card,6,2)
when b.exam_batch is null and a.exam_type_id=2 then substring(a.admission_card,5,2)
when b.exam_batch is not null and a.exam_type_id=2 then substring(a.admission_card,1,2)
end as '批次'
from t_exam_score a left join t_apply_info b on a.admission_card = b.admission_card
恩大概就是这个意思,搜索出来的结果对吗?