Received: from pop.telekabel.at (pop.telekabel.at [195.34.134.66]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA64156 for ; Sun, 29 Aug 1999 11:43:56 -0400 (EDT) (envelope-from T.Schallar@AVALON.at) Received: from mgate3.telekabel.at ([195.34.133.22]) by pop.telekabel.at (Post.Office MTA v3.1.2 release (PO203-101c) ID# 0-61574U30000L30000S0V35) with ESMTP id AAA9494 for ; Sun, 29 Aug 1999 17:43:17 +0200 Received: from AVALON.at ([195.34.153.33]) by mgate3.telekabel.at (Post.Office MTA v3.5.2 release 221 ID# 0-57067U15000L15000S0V35) with ESMTP id at for ; Sun, 29 Aug 1999 17:43:02 +0200 Message-ID: <37C95508.B50F49BD@AVALON.at> Date: Sun, 29 Aug 1999 17:43:04 +0200 From: "Dipl.-Ing. Thomas Schallar" Reply-To: avalon@teleweb.at Organization: AVALON Computersystem Ges.m.b.H. - http://AVALON.at/ X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: de-AT,de,en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: SELECT multiple tables with same fields Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello! Imagine two tables CREATE TABLE one ( name varchar(10), content varchar(10) ); CREATE TABLE two ( name varchar(10), something_different varchar(10) ); with some rows in each of them and and a query SELECT * INTO new_table FROM one, two WHERE one.name=two.name; If there are matching fields, then the query would return some joined rows. But it can't, because the column "name" comes twice in the tables! Of course SELECT one.*, two.name AS two_name, two.something_different INTO new_table FROM one, two WHERE one.name=two.name; does the work, because I rename the duplicate columns. Before I started programming with Postgres I've done my stuff with Microsoft Visual Basic and Access. Access has the lovely feature, that doubly selected column names are automatically renamed to . (or _? I can't remember at the moment; sorry!) so everything works fine. Is there some similar feature in Postgres? I'm asking, because I have queries over up to seven tables joined and the fields in those tables are growing larger and larger. But if I add fields, than I have to add them to each of the SELECT statements also, that they won't be missed off. That's boaring und faulty. Any help welcome! regards, Thomas (Vienna, Austria, Europe)