【问题标题】:How to omit the first result in the query fetching column names?如何在获取列名的查询中省略第一个结果?
【发布时间】:2019-09-19 10:33:16
【问题描述】:

我正在从特定表中获取列名:

SELECT column_name
FROM information_schema.columns
WHERE table_schema = 'public' AND 
      table_name = " + "'" + SQL_RPL_TABLE_NAME + "'";

表名有一个占位符。第一列通常是我不需要获取的 ID,因为它应该自动插入到我的表中。但我真的需要基于表名的其他列名。这里怎么做?

【问题讨论】:

    标签: java sql spring jsp


    【解决方案1】:

    你会添加:

    and ordinal_position > 1
    

    这是列位置的枚举。

    【讨论】:

    • 如果您希望列按定义的顺序排列,您可能还需要添加ORDER BY ordinal_position
    猜你喜欢
    • 1970-01-01
    • 2015-03-16
    • 2015-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多