Re: Alias name from subquery
От | Felix Homann |
---|---|
Тема | Re: Alias name from subquery |
Дата | |
Msg-id | 48E237DD.5050603@onlinehome.de обсуждение исходный текст |
Ответ на | Alias name from subquery (Felix Homann <fexpop@onlinehome.de>) |
Ответы |
Re: Alias name from subquery
|
Список | pgsql-general |
Hi Jeffrey, Thanks for your quick response! Hoover, Jeffrey wrote: > > select (SELECT name from colnames WHERE id=1) as entry from entries; > I think, I should have been a bit clearer in what I need: I've got two tables, colnames and entries: test=# SELECT * from colnames; id | name ----+------ 1 | col1 (1 row) test=# SELECT entry from entries; entry -------- first second third (3 rows) I would like to get the column name "entry" replaced by an alias "col1", just like this: test=# SELECT entry as col1 from entries; col1 -------- first second third (3 rows) _But_, I don't want to give the alias explicitely, instead it should be taken from a second table 'colnames', i.e. something like the line I sent in my initial mail. Any idea? Thanks again, Felix BTW, here's what I get from your command: test=# select (SELECT name from colnames WHERE id=1) as entry from entries; entry ------- col1 col1 col1 (3 rows)
В списке pgsql-general по дате отправления: