1
如果Email被列入黑名單,我希望下面的查詢結果爲Y,否則運行內部查詢並返回特定設施名稱。mysql:內部查詢在selectif語句中不起作用
Select if (EmailBlacklisted = 'Y', 'Y',
'select a.facilityname from facility a
inner join domainfacility b on a.facility_ID=b.facility_facility_ID
inner join domain c on b.domain_Domain_ID = c.Domain_ID
where a.facilitystatus="A" and c.DomainName = "cd.com" ')
from domain where DomainName= 'cd.com';
但是查詢返回與RESULT相同的內部查詢,如果emailBlacklisted在域表中是N的話。請幫助
編輯你的問題,並提供樣本數據和預期的結果。 –