Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 352012E0040 for ; Thu, 3 Jan 2008 05:11:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 76987-09 for ; Thu, 3 Jan 2008 05:11:06 -0400 (AST) Received: from smtp-out02.email.it (smtp-out02.email.it [212.97.34.22]) by postgresql.org (Postfix) with ESMTP id B2B592E003E for ; Thu, 3 Jan 2008 05:11:05 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp-out02.email.it (Postfix) with ESMTP id A3B7F2C013 for ; Thu, 3 Jan 2008 10:11:03 +0100 (CET) X-Virus-Scanned: amavisd-new at email.it Received: from smtp-out02.email.it ([127.0.0.1]) by localhost (smtp-out02.email.it [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JiLlZ+i3oc03 for ; Thu, 3 Jan 2008 10:11:03 +0100 (CET) Date: Thu, 3 Jan 2008 10:11:05 +0100 To: pgsql-admin@postgresql.org From: giuseppe.derossi@email.it Reply-to: giuseppe.derossi@email.it Subject: dynamic name of table in select Message-ID: <3fce0e1505967341e43d6d87c5bd4afc@164.129.1.41> X-Priority: X-Mailer: Webmail-Email.it [Mailer version 1.70] X-SenderIP: 164.129.1.41 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/37 X-Sequence-Number: 27811 Hi to all, I need help about the following issue: in my db I've three table which have the same column (there are some reasons for that) I'd like to perform a select statement like that: select my_column from xxx_table . Where xxx could be choosen from another table result. for example : select my_column from (select name_table from catalog where condition1) now the internal select has to return the name of the table which is linked to the condition1 (let me say condition1_table) so after the inner select has been perfomed, I should have select my_column from condition1_table Is it possible ? Second question: is there a system variable where the name of the db is stored ? how can I recall it? Thanks in advance and best regards Giu -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Realizza i tuoi sogni con i finanziamenti Finatel! Fino a 50.000 Euro senza spese in pochissimo tempo. Richiedi Informazioni Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7371&d=20080103