SQL命令中的case...when...then...else...end条件查询
select b.XH, b.ZBXH, a.SJKSMC, a.JCRQ, a.JYRQ, a.JCJBMC, a.CYZMC,
b.CYDDMC, b.CYDXMC, BGRQ, b.JCXMMC,b.DCAXJ,b.ZHJ,b.SMSJ, b.JYJGMC, a.JCJBDM, a.CYZDM, SJKSDM,
case when b.JYJGDM = 0 then '合格' when b.JYJGDM = 1 then '不合格' else '' end JYJG
from YG_HJWS_WSJCZB a join YG_HJWS_WSJCMXB b on a.JCXH = b.ZBXH
and a.JCRQ BETWEEN '20170901' AND '2017093024'