From: Kris Jurka <books@ejurka.com>
To: Simon Moses <ks_moses@yahoo.com>
Cc: pgsql general <pgsql-general@postgresql.org>
Cc: pgsql jdbc <pgsql-jdbc@postgresql.org>
Subject: Re: [JDBC] create view problem
Date: Mon, 18 Oct 2004 00:42:01 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0410180039480.15898@leary.csoft.net> (raw)
In-Reply-To: <20041018053631.80052.qmail@web14924.mail.yahoo.com>
References: <20041018053631.80052.qmail@web14924.mail.yahoo.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, ks_moses@yahoo.com, pgsql-general@postgresql.org
Subject: Re: [JDBC] create view problem
In-Reply-To: <Pine.BSO.4.56.0410180039480.15898@leary.csoft.net>
References: <20041018053631.80052.qmail@web14924.mail.yahoo.com> <Pine.BSO.4.56.0410180039480.15898@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox