guido
guido

Reputation: 75

How to omit the first result in the query fetching column names?

I'm fetching column names from a specific table:

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

There is a placeholder for table name. The first column is usually the ID which I don't need to fetch as it should insert itself automatically in my table. But I really need the other column names based on the table name. How to do it here?

Upvotes: 0

Views: 43

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270401

You would add:

and ordinal_position > 1

This is the enumeration of the column positions.

Upvotes: 3

Related Questions