Oct 22, 2018

[HDGEM] How to fix MySQL: Incorrect usage of UNION and LIMIT

Or mysql error 1221 incorrect usage of union and orderby. To fix, just add parenthesis to those union statements. It works for me, for example:
(select ... limit 1)
union
(select ... limit 1)
union
(select ... limit 1)

union all with parenthesis works too.

--
Posted By Blogger to HDGEM at 1/14/2017 09:58:00 PM