I’ve got two mySQL servers – offline is version 5.5.25, online is version 5.0.95. I am attempting to run a UNION SELECT to join two result sets together. Both queries extract the same data from the same tables using the same joins – the only difference to each is the where query. Basic syntax is:
(SELECT QUERY A)
UNION
(SELECT QUERY B)
ORDER BY date_created DESC, subscription_rate_id ASC
If I run this query offline, I get this error:
Error Number: 1064
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘INNER JOINwebmasterd ONd.dupe_master_id=
webmaster.webmaster_idIN’ at line 16
If I run the queries separately then both of them work. If I run the whole query ONLINE, it works. This only occurs in my OFFLINE mySQL which is running the newer mySQL version of the two. I believe the error relates to query B – but the same INNER JOIN is in query A.
The query is horrendously long and not easily shortened / broken down which is why I haven’t pasted it here. I will find a way to provide it if absolutely neccessary.
Any help appreciated.
Remove the braces around
to
See SQL Fiddle for different versions and error message.