MySQL 5左联接未知列

编程入门 行业动态 更新时间:2024-10-26 22:21:27
本文介绍了MySQL 5左联接未知列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在mysql 4.1中有以下查询,但在5.0中却没有:

I had the below query working in mysql 4.1, but does not in 5.0:

SELECT * FROM email e, event_email ee LEFT JOIN member m on m.email=e.email WHERE ee.email_id = e.email_id

错误: 1054(子句"中的未知列"e.email")

The error: 1054 (Unknown column 'e.email' in 'on clause')

推荐答案

您只能在ON子句中引用以前与JOIN子句连接的表.

You can only refer the tables previously joined with the JOIN clause in the ON clause.

SELECT * FROM email e JOIN event_email ee ON ee.email_id = e.email_id LEFT JOIN member m ON m.email = e.email

如果我在原始查询中的ANSI JOINS周围加上括号,则可以更好地说明这一点:

This can be illustrated better if I put the parentheses around the ANSI JOINS in your original query:

SELECT * FROM email e, ( event_email ee LEFT JOIN member m ON m.email = e.email ) WHERE ee.email_id = e.email_id

如您所见,括号内没有e.email的来源:这就是为什么它无法解析的原因.

As you can see, there is no source for e.email inside the parentheses: that's why it could not be resolved.

更多推荐

MySQL 5左联接未知列

本文发布于:2023-10-20 22:28:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1512325.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MySQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!