Reputation: 283043
In MySQL, select *,1 from t
appears to be valid, but select 1,* from t
is not.
Upvotes: 3
Views: 148
Reputation: 16502
From the MySQL docs, you are told what you can do with the unqualified *
:
A select list consisting only of a single unqualified
*
can be used as shorthand to select all columns from all tables:
SELECT * FROM t1 INNER JOIN t2 ...
The pertinent documentation you're looking for is two bullet points below that:
Use of an unqualified
*
with other items in the select list may produce a parse error. To avoid this problem, use a qualifiedtbl_name.*
reference
Unfortunately the why is not explained in the docs, and would likely take some digging.
Upvotes: 5