爲什麼會導致語法錯誤(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做同樣的事情。 –