Reputation: 303
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 JOIN
webmaster
d ONd
.dupe_master_id
=webmaster
.webmaster_id
IN' 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.
Upvotes: 0
Views: 1091
Reputation: 74028
Remove the braces around
FROM (`webmaster`)
to
FROM `webmaster`
See SQL Fiddle for different versions and error message.
Upvotes: 3