MarkMpn / Sql4Cds

SQL 4 CDS core engine and XrmToolbox tool
MIT License
75 stars 22 forks source link

【Bug】ORDER BY not working #356

Closed hiroyuki0415 closed 1 year ago

hiroyuki0415 commented 1 year ago
SELECT   a1.entitylogicalname,
         a1.logicalname,
         a1.environment
FROM     (SELECT entitylogicalname,
                 logicalname,
                 'env1' AS environment
          FROM   [env1].metadata.attribute
          UNION ALL
          SELECT entitylogicalname,
                 logicalname,
                 'env2' AS environment
          FROM   [env2].metadata.attribute) AS a1
         INNER JOIN
         [env3].metadata.attribute AS a2
         ON a1.entitylogicalname = a2.entitylogicalname
            AND a1.logicalname = a2.logicalname
WHERE    a1.entitylogicalname IN ('systemuser', 'businessunit')
         AND a1.logicalname IN ('createdon')
ORDER BY a1.entitylogicalname;

The result of this SQL is below: ORDER BY is not working

 entitylogicalnamelogicalnameenvironment
 businessunitcreatedonenv1
 systemusercreatedonenv1
 businessunitcreatedonenv2
 systemusercreatedonenv2

Thanks in advance for your support.