[GENERAL] Alias name from subquery

2008-09-30 Thread Felix Homann
Hi, I would like to set an alias name for a column from a subquery, i.e. something like this: SELECT entry AS (SELECT name from colnames WHERE id=1) from entries ; Obviously it doesn't work _this_ way, but is there _any_ way to do it? Kind regards, Felix -- Sent via pgsql-general mailing l

Re: [GENERAL] Alias name from subquery

2008-09-30 Thread Felix Homann
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 +

Re: [GENERAL] Alias name from subquery

2008-09-30 Thread Felix Homann
Raymond O'Donnell wrote: select entry from (select name from colnames where id = 1) as entry_with_different_name; ...maybe? Thanks Ray! No, "entry_with_different_name" should be the result of "SELECT name FROM colnames WITH id=1". Kind regards, Felix -- Sent via pgsql-general mailing li

Re: [GENERAL] Alias name from subquery

2008-09-30 Thread Felix Homann
Hi Sam, Sam Mason wrote: I think you may be trying to solve the wrong problem, what are you really trying to do? Here you go. I have some tables created like this: CREATE TABLE player( id INTEGER PRIMARY KEY, name varchar(20) ); CREATE TABLE transfer( id SERIAL PRIMARY KEY, fromID

Re: [GENERAL] Alias name from subquery

2008-09-30 Thread Felix Homann
Thanks to Scott and Taras for pointing me to the crosstab functions. I only had a quick look but they seem very helpful! Kind regards, Felix -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-gene