Convert Oracle outer join to SQL Server

后端 未结 1 1553
谎友^
谎友^ 2021-01-27 21:41

I\'m having trouble converting this Oracle SQL to SQL server.

This is the query:

    SELECT CM.ModuleID,
           CM.ModuleDescription,
           CM.         


        
相关标签:
1条回答
  • 2021-01-27 22:41

    This should work in 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;
    
    0 讨论(0)
提交回复
热议问题