select as

Started by Bamberoover 21 years ago2 messagesgeneral
Jump to latest
#1Bambero
bambero@tlen.pl

Hello

Is there any easy way to select all fields from table (*) but the result
should looks like this:

1| 2| 3
----+-----+------
asas| asd | dasd
ada | ads | dasa

Column name should be a number of column.

I don't know what fields are in the table so:

select fieldname as 1, fieldname2 as 2

is useless.

Bambero

#2Bruce Momjian
bruce@momjian.us
In reply to: Bambero (#1)
Re: select as

Bambero <bambero@tlen.pl> writes:

I don't know what fields are in the table so:

select fieldname as 1, fieldname2 as 2

is useless.

slo=> create table x (foo text,bar text,baz text);
CREATE TABLE
slo=> select * from (select * from x) as x ("1","2","3");
1 | 2 | 3
---+---+---
(0 rows)

--
greg