hola amigos de SAP estoy tratando de crear una vista con esta consulta que me pasaron pero me sale error alguien sabe como lo puedo solucionar.
este es el error: Msg 4506, Level 16, State 1, Procedure view_Oc_OV_Entrg, Line 3 [Batch Start Line 0]
Column names in each view or function must be unique. Column name ‘DocEntry’ in view or function ‘view_Oc_OV_Entrg’ is specified more than once.
CREATE VIEW view_Oc_OV_Entrg
AS
Select distinct * From
--Orden Orden Venta
(SELECT T1."DocEntry", T1."BaseEntry", T1."TrgetEntry", T0."DocNum" as No_OV, T0."DocDate" as fecha_OV, T1."ItemCode", T1."BaseLine", T1."LineNum"
FROM ORDR T0 LEFT OUTER JOIN RDR1 T1 ON T0."DocEntry" = T1."DocEntry" where year(T0."DocDate")>=2020 ) P0
LEFT OUTER JOIN
---- Entrega
(SELECT T1."DocEntry", T1."BaseEntry", T1."TrgetEntry", T0."DocNum" as No_Ent, T0."DocDate" fecha_Ent, T1."ItemCode", T1."BaseLine", T1."LineNum"
FROM ODLN T0 LEFT OUTER JOIN DLN1 T1 ON T0."DocEntry" = T1."DocEntry" where year(T0."DocDate")>=2020 ) P1
ON P0."DocEntry" = P1."BaseEntry" And P0."LineNum" = P1."BaseLine"
LEFT OUTER JOIN
---- Orden de Compra
(SELECT T1."DocEntry", T1."BaseEntry", T1."TrgetEntry", T0."DocNum" as No_OC, T0."DocDate" fecha_OC, T1."ItemCode", T1."BaseLine", T1."LineNum"
FROM OPOR T0 LEFT OUTER JOIN POR1 T1 ON T0."DocEntry" = T1."DocEntry" where year(T0."DocDate")>=2020) P2
ON P0."DocEntry" = P2."BaseEntry" And P0."LineNum" = P2."BaseLine"