pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
create view problem
2+ messages / 2 participants
[nested] [flat]

* create view problem
@ 2004-10-18 05:36 Simon Moses <ks_moses@yahoo.com>
  2004-10-18 05:42 ` Re: [JDBC] create view problem Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Simon Moses @ 2004-10-18 05:36 UTC (permalink / raw)
  To: pgsql general <pgsql-general@postgresql.org>; pgsql-jdbc

dear sir,
i am trying to create view with following query

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?

thanks in advance,
-Simon Moses,
Bangalore, India.

=====
**************************
Visit My Home Page
http://www.geocities.com/ks_moses
updated: 28 Sep 2004.
Simon Moses
**************************


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [JDBC] create view problem
  2004-10-18 05:36 create view problem Simon Moses <ks_moses@yahoo.com>
@ 2004-10-18 05:42 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2004-10-18 05:42 UTC (permalink / raw)
  To: Simon Moses <ks_moses@yahoo.com>; +Cc: pgsql general <pgsql-general@postgresql.org>; pgsql-jdbc



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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-18 05:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-18 05:36 create view problem Simon Moses <ks_moses@yahoo.com>
2004-10-18 05:42 ` Kris Jurka <books@ejurka.com>

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