提示:
ERROR 1054 (42S22): Unknown column ... in 'on clause'
原因:
MySQL5.0 Bug, 要把联合的表用括号包含起来才行:
例:
SELECT (c.id, a.id, b.id) FROM A a, B b LEFT JOIN C c ON c.a_id = a.a_id AND c.b_id = b.b_id
这句话执行应该是没有错误的,但是Mysql 5 下执行则会出错。
因为mysql下有这样一个BUG,要把联合的表用括号包含起来才行:
SELECT (c.id, a.id, b.id) FROM (A a, B b) LEFT JOIN C c ON c.a_id = a.a_id AND c.b_id = b.b_id
但是HQL生成就是这样的语句,怎么办呢?我们可以改变HQL的写法来达成生成另一种SQL语句,以避免这种BUG的出错
把select (c.id, a.id, b.id) from C c Left join c.a a Left join c.b b
则会生成
SELECT (c.id, a.id, b.id) FROM A a LEFT JOIN B b LEFT JOIN C c ON c.a_id = a.a_id AND c.b_id = b.b_id
这样的话mysql下就不会出错了。
以上文章了来自网络。
分享到:
相关推荐
4.2 Logging On to the MySQL Database Server . . . . . . . . . . . . . . . 41 4.3 Creating New SQL Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.4 Creating Databases . . . . . . ...
ERROR 1054 (42S22): Unknown column *** in 'where clause' ERROR 1064 (42000): You have an error in your SQL syntax; ERROR 1072 (42000): Key column '***' doesn't exist in table ERROR 1142 (42000): ...
Part III: Using MySQL Stored Programs in Applications Chapter 12. Using MySQL Stored Programs in Applications Section 12.1. The Pros and Cons of Stored Programs in Modern Applications Section ...
登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user set password=password(‘root’) where user=’root’时提示ERROR 1054 (42S22): Unknown column ...
...
。。。
mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
1000BASE-X IEEE 802.3-2008 Clause 36 - Physical Coding Sublayer (PCS)_latest.tar.gz
Table of Contents Introduction....................................................................................................13 Code Examples.........................................................
资源分类:Python库 所属语言:Python 资源全名:clause-1.1.2.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Well Supported in Third-Party Tools ...................................................................12 Good Selection of Tools Available ...............................................................
Clause 116 through Clause 124 and associated annexes include general information on 200 Gb/s and 400 Gb/s operation as well the 200 Gb/s and 400 Gb/s Physical Layer specifications. Clause 125 and ...
Clause37 GE自协商原理,自协商状态图详细讲解; • Location in the OSI Stack • Interface to the PCS • Auto-Negotiation functionality
Basically this adds a "[fieldname] Like [value]" to the WHERE clause. -Paging- Admin can specify whether to use paging on the grid and how many records to show per page. -Export datagrid to an Excel ...
The number of levels in an index will vary depending on the number of rows in the table and the size of the key column or columns for the index. If you create an index using a large key, fewer ...
3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................
mysql中You can’t specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中)。 例如下面这个sql: 代码如下: delete from tbl where id in ...
最近在工作中遇到了一个mysql错误提示1093:You can’t specify target table for update in FROM clause,后来通过查找相关的资料解决了这个问题,现在将解决的方法分享给大家,有需要的朋友们可以参考借鉴,下面来...
3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................
Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause;...