SQL Developer在创建视图时重复列名



在运行下面指定的语句时出现此错误

ORA-00957:重复的列名
00957。00000 -"重复的列名">

我查询:

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;

只需添加列别名。

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;

相关内容

  • 没有找到相关文章

最新更新