using ordinal_position

Поиск
Список
Период
Сортировка
От John Fabiani
Тема using ordinal_position
Дата
Msg-id 4FD1368E.5000304@jfcomputer.com
обсуждение исходный текст
Ответы Re: using ordinal_position  ("David Johnston" <polobo@yahoo.com>)
Re: using ordinal_position  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-sql
I'm attempting to retrieve data using a select statement without knowing 
the column names. I know the ordinal position but not the name of the 
column (happens to be a date::text and I have 13 fields).

Below provides the name of the column in position 3:

select column_name from (select column_name::text, ordinal_position from 
information_schema.columns where
table_name='wk_test') as foo where ordinal_position = 3;

But how can I use the above as a column name in a normal select statement.

Unlike other databases I just can't use ordinal position in the select 
statement - RIGHT???

Johnf


В списке pgsql-sql по дате отправления:

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: defaults in a function
Следующее
От: "David Johnston"
Дата:
Сообщение: Re: using ordinal_position