0

I am getting this error while running statement specified below

ORA-00957: duplicate column name
00957. 00000 - "duplicate column name"

My query:

create view vw_sales_may 
as 
    select 
        customers.id, orderdetails.id, sales.sale_date, sales.total_value 
    from 
        customers 
    inner join 
        sales on customers.id = sales.customer_id 
    join 
        orderdetails on orderdetails.customer_id = customers.id 
    where 
        to_char(sale_date, 'MM') = 05;
0

1 Answer 1

1

Just need to add column aliases.

create view vw_sales_may as 
select customers.id as CustomerID, 
orderdetails.id as OrderDetailsID, 
sales.sale_date, 
sales.total_value 
from customers 
inner join sales on customers.id = sales.customer_id 
join orderdetails on orderdetails.customer_id = customers.id 
where to_char(sale_date,'MM') = 05;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.