[42000]关键字 ‘UNION‘ 附近有语法错误。 (156) or > 1221 - Incorrect usage of UNION and ORDER BY

在SQL下是:[42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]关键字 ‘UNION‘ 附近有语法错误。 (156)

这个错误提示在mysql中是:> 1221 - Incorrect usage of UNION and ORDER BY

很久不写SQL语句了,今天又遇到这玩意,原因是UNION ALL 不能跟 ORDER BY一起用,除非是把ORDER BY放union语句的子查询里

posted @ 2022-10-04 00:14  IT情深  阅读(390)  评论(0)    收藏  举报