SQL问题,谁能帮我讲清楚,谢谢大家了!!!
SELECT CUSTOMERMST.CUSTOMERCD CUSTOMERMST.CUSTOMERNM,SUBUNITCD = CASE CUSTOMERMST.CSTKNDCD WHEN '5 ' THEN '001 ' ELSE SUBUNITMST.SUBUNITCD END ,CUSTOMERMST.TRADEMARKCD FROM CUSTOMERMST INNER JOIN SUBUNITMST ON CUSTOMERMST.SUBUNITCD = SUBUNITMST.SUBUNITCD WHERE 1=1
其中 SUBUNITCD = CASE CUSTOMERMST.CSTKNDCD WHEN '5 ' THEN '001 ' ELSE SUBUNITMST.SUBUNITCD END 什么意思,谢谢大家了帮帮忙
------解决方案--------------------如果
CUSTOMERMST.CSTKNDCD = 5
SUBUNITCD = 001
否则
SUBUNITCD = SUBUNITMST.SUBUNITCD