X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5243032A900 for ; Mon, 18 Oct 2004 06:42:08 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45410-05 for ; Mon, 18 Oct 2004 05:42:05 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id EA6DA32A91E for ; Mon, 18 Oct 2004 06:42:03 +0100 (BST) Received: (qmail 13739 invoked by uid 1112); 18 Oct 2004 05:42:01 -0000 Date: Mon, 18 Oct 2004 00:42:01 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Simon Moses Cc: pgsql general , pgsql jdbc Subject: Re: [JDBC] create view problem In-Reply-To: <20041018053631.80052.qmail@web14924.mail.yahoo.com> Message-ID: References: <20041018053631.80052.qmail@web14924.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.2 tagged_above=0.0 required=5.0 tests=DEAR_SOMETHING X-Spam-Level: * X-Archive-Number: 200410/757 X-Sequence-Number: 67281 On Sun, 17 Oct 2004, Simon Moses wrote: > dear sir, > i am trying to create view with following query This has nothing to do with JDBC or Java, so it should not be sent to the JDBC list. > create view salesQ as > select * from sales, customer where sales.customerkey > = customer.customerkey; > > it is giving > > ERROR: column "customerkey" duplicated > > create view salesQ as > select sales.*, customer.* from sales, customer where > sales.customerkey = customer.customerkey; > > also giving same error. > i cannot change field names or specify field names in > view definition because many fields are there in both > tables. how to create this view? > You need to use aliases in your SELECT... SELECT sales.customerkey AS salescustomerkey, customer.customerkey AS customercustomerkey, ... FROM sales, customer WHERE ... Kris Jurka