[Err] 1054 - Unknown column 'o.ordersId' in 'on clause'

解决方法:将from后面的表用()来。

例:

SELECT a.id, b.id, c.id FROM A a, B b LEFT JOIN C c ON c.a_id = a.a_id AND c.b_id = b.b_id  

这句话在mysql5下执行会有问题,要把联合的表用括号包含起来才行:

SELECT a.id, b.id, c.id) FROM (A a, B b) LEFT JOIN C c ON c.a_id = a.a_id AND c.b_id = b.b_id  

这样就可以执行了、

posted on 2018-03-28 15:35  减肥的小老斧  阅读(24948)  评论(0编辑  收藏  举报