MySQL:选择表中的所有列以及同一表中的一列 [英] MySQL: Selecting all columns in a table plus one column from the same table
问题描述
我有一个包含许多列的表,可以说column1,.... column20.我不想每次都滚动到结果表的末尾以查看column20的值.在mssql中我通常会做
SELECT column20, * FROM TABLE
,但显然这在MySQL中无效.有什么提示吗? (我也不想在select语句中显式选择所有列)
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)
推荐答案
您必须在查询中提供表名,否则mysql会抱怨:
You have to give the table name in your query, otherwise mysql complains :
SELECT column20, mytable.* FROM mytable
PS:我绝对不知道为什么,因为SELECT *, column20 FROM mytable
可以正常工作...有时会发生奇怪的事情^^
PS: I have absolutely no idea as to why, because SELECT *, column20 FROM mytable
works just fine... Strange things happens sometimes ^^
这篇关于MySQL:选择表中的所有列以及同一表中的一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!