这个sql语句可以简化一下吗

只有一个筛选条件不同,但是需求是必须输出两个不同的列。或者能用decode或者case也行,本人才疏学浅尝试了很多种方法都没写出来,求大佬图片

可以直接left join scrore表 =99和等于93可以作为on的条件

select a.sno,b1.scores from student a
left join score b1 on a.sno=b1.son and (b1.scores=99 or scores=93)

select
a.sno,
(case when b.scores=99 then b.scores else '' end) as scores1,
(case when b.scores=93 then b.scores else '' end) as scores2
from student a left join score b on a.sno=b.sno
where b.scores=99 or b.scores=93;
参考自:MySQL控制流程函数 http://www.data.5helpyou.com/article327.html