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;
CodePudding user response:
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;