SQL 开发人员在创建视图时重复列名
SQL Developer duplicate column name while creating view
我在下面指定 运行 语句时遇到此错误
ORA-00957: duplicate column name
00957. 00000 - "duplicate column name"
我的查询:
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;
我在下面指定 运行 语句时遇到此错误
ORA-00957: duplicate column name
00957. 00000 - "duplicate column name"
我的查询:
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;