MySQL:选择表中的所有列以及同一表中的一列 [英] MySQL: Selecting all columns in a table plus one column from the same table

查看:200
本文介绍了MySQL:选择表中的所有列以及同一表中的一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多列的表,可以说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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆