我在将此Oracle SQL转换为SQL服务器时遇到问题。
这是查询:
SELECT CM.ModuleID,
CM.ModuleDescription,
CM.ImageIndex,
CASE
WHEN CMAC.ClassID IS NULL THEN
'N'
ELSE
'Y'
END AS Checked
FROM APP_MODULES CM,
APP_PROFILE CMAP,
APP_PROFILE_CLASS CMAC
WHERE 1 = 1
AND CM.ParentModuleID IS NULL
AND CMAP.ProfileID(+) = CMAC.ProfileID
AND CM.ModuleID = CMAC.ModuleID(+)
AND CMAC.ProfileID(+) = P_ProfileID
AND CM.Activated = 'Y'
ORDER BY CM.Ordem;
任何人都可以帮助我吗?
答案 0 :(得分:0)
这应该适用于SQL Server:
SELECT CM.ModuleID,
CM.ModuleDescription,
CM.ImageIndex,
CASE
WHEN CMAC.ClassID IS NULL THEN
'N'
ELSE
'Y'
END AS Checked
FROM APP_MODULES CM,
LEFT JOIN APP_PROFILE_CLASS CMAC
ON(CMAC.ProfileID = P_ProfileID AND CM.ModuleID = CMAC.ModuleID)
LEFT JOIN APP_PROFILE CMAP
ON(CMAP.ProfileID = CMAC.ProfileID)
WHERE 1 = 1
AND CM.ParentModuleID IS NULL
AND CM.Activated = 'Y'
ORDER BY CM.Ordem;