我有许多在 MySQL 4 下运行的 MySQL 语句,但不是 MySQL 5。这些语句结合了 UNION 和 JOIN。
为了简化 MySQL 语句,我得出以下在 MySQL 4 下运行但不在 MySQL 5 下运行的语句:
SELECT
bteamres.rank AS `rank`
FROM
bteamres
LEFT OUTER JOIN (btourn AS tourn) ON (bteamres.tourncode=tourn.tourncode)
WHERE
(bteamres.nofivb1=100427)
UNION
SELECT
bteamres.rank AS `rank`
FROM
bteamres
LEFT OUTER JOIN (btourn AS tourn) ON (bteamres.tourncode=tourn.tourncode)
WHERE
(BTEAMRES.NOFIVB2=100427)
我收到的错误代码是:
[Err] 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 'ON (bteamres.tourncode=tourn.tourncode)
WHERE
(BTEAMRES.NOFIVB2=100427)' at line 15
如果我删除连接,请求在 MySQL 4 和 MySQL 5 上都可以正常工作。我知道 MySQL 4 和 MySQL 5 之间存在一些语法差异,但我看不出如何使这个语句工作。
感谢您的帮助。帕特里克