create view problem

Started by Simon Mosesover 21 years ago2 messagesgeneral
Jump to latest
#1Simon Moses
ks_moses@yahoo.com

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

#2Kris Jurka
books@ejurka.com
In reply to: Simon Moses (#1)
Re: [JDBC] create view problem

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