某些版本的mysql不支持join语句?急!!!
select c.contname, s.totpts from chartercommittees cc left outer join stats s on s.chartercommid = cc.chartercommid
and s.we = '2007-08-02 00:00:00 ' join conts c on cc.cccontid = c.cccontid Where cc.cccontid not in (13, 14)
这个语句在我本地mysql运行很正常,放客户服务器上就通不过,报sql语法错误You have an error in your SQL syntax near 'on cc.cccontid = c.cccontid Where cc.cccontid not in (13, 14)
必须改成select c.contname, s.totpts from chartercommittees cc,conts c left outer join stats s on s.chartercommid = cc.chartercommid
and s.we = '2007-08-02 00:00:00 ' Where cc.cccontid = c.cccontid and cc.cccontid not in (13, 14) 才可以用
我本地mysql是4.0.26,客户server的是mysql 3.23,我觉得可能与mysql设置有关,大家以前遇到过这个问题吗?
------解决方案--------------------mysql 3.22以下版本不支持子查询, 但所有的子查询都可以使用
LEFT JOIN 或 and语句替代. 但mysql 3.23需要安装补丁,或升级该版本.
------解决方案--------------------升级你的MYSQL。