我有以下查詢我試圖展現消息「不副信號源此RAO」當沒有「tblOrganisation.Name」,請有看到下面的查詢,它做工精細但沒有顯示我的消息時沒有organisation.name返回的Sql ELSE情況下不能正常工作
DECLARE @RAOID INT, @ORGID INT
SET @ORGID = 28
SET @RAOID = (SELECT RAOID FROM tblOrganisation WHERE ORGID = @ORGID)
PRINT @RAOID
IF @RAOID IS NOT NULL
BEGIN
SELECT
CASE
WHEN tblOrganisation.ORGID IS NOT NULL THEN tblOrganisation.ORGID
ELSE 'No ORGID'
END AS ORGID,
CASE
WHEN tblOrganisation.Name IS NOT NULL THEN tblOrganisation.Name
ELSE 'No SubSource for this RAO'
END as SUBSOURCENAME
FROM tblOrganisation
LEFT OUTER JOIN tblSubGroup ON tblOrganisation.SubGroupID = tblSubGroup.SubGroupID
WHERE
tblSubGroup.RAOID = @RAOID
END
謝謝。
最好的問候, MS
什麼數據庫系統?什麼版本? – 2009-09-02 06:30:56
如果您還有不那麼工作現場不爲空。它回來了什麼? – Donnie 2009-11-29 16:16:51