SQL 返回表的前两列 [英] SQL to return first two columns of a table
本文介绍了SQL 返回表的前两列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何 SQL
行话只返回表的前两个 columns
WITHOUT 知道字段 names>?
Is there any SQL
lingo to return JUST the first two columns
of a table WITHOUT knowing the field names?
类似的东西
SELECT Column(1), Column(2) FROM Table_Name
还是我必须走很长的路才能先找出列名?我该怎么做?
Or do I have to go the long way around and find out the column names first? How would I do that?
推荐答案
你必须先得到列名.大多数平台都支持这一点:
You have to get the column names first. Most platforms support this:
select column_name,ordinal_position
from information_schema.columns
where table_schema = ...
and table_name = ...
and ordinal_position <= 2
这篇关于SQL 返回表的前两列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文