为什么会导致语法错误(MySQL 5)?为什么向MySQL查询添加'*'会导致语法错误?
mysql> select f, blegg.* from blegg limit 1;
+------+------+------+------+
| f | f | g | h |
+------+------+------+------+
| 17 | 17 | 2 | 17 |
+------+------+------+------+
1 row in set (0.00 sec)
mysql> select f, * from blegg limit 1; -- * is unqualified
ERROR 1064 (42000): 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 '*
from blegg limit 1' at line 1
我已经看过手册,但没有真正找到任何东西。为什么select <field>, * ...
失败,其中select <field>, <table>.* ...
和select * ...
和select *, <field> ...
成功?
我无法解释为什么。但我知道Oracle做同样的事情。 –