Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: Selecting all columns in a table plus one column from the same table

Tags:

mysql

I have a table with many columns let say column1,....,column20. I don't want to scroll everytime to the end of the result table to see the value of column20. In mssql I usually do SELECT column20, * FROM TABLE but apparently this is not valid in MySQL. Any hints? (I also don't want to select all columns explicitly in the select statement)

like image 727
donebizkit Avatar asked Nov 25 '12 01:11

donebizkit


1 Answers

You have to give the table name in your query, otherwise mysql complains :

SELECT column20, mytable.* FROM mytable

PS: I have absolutely no idea as to why, because SELECT *, column20 FROM mytable works just fine... Strange things happens sometimes ^^

like image 191
krtek Avatar answered Sep 22 '22 23:09

krtek