SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE   VIEW [load].[Offene_Auftraege]
AS
SELECT T1.[Client_DB]
     , T1.[Make Code]
     , T1.[Model]
     , T1.[Hauptbetrieb]
     , T1.[Standort]
     , T1.[Serviceberater]
     , T1.[Umsatzart]
     , T1.[Kunde]
     , T1.[benutzte AW]
     , T1.[Durchgänge]
     , T1.[Tage offen]
     , T1.[gebuchte Teile]
     , T1.[Order Number]
     , T1.[Invoice Date]
     , T1.[Anz. Tage letzte Stemp.]
     , T1.[Intern/Extern]
     , T1.[Tage über Abholtermin]
     , T1.[Order Number_intern_neu]
     , T1.[Kostenstelle]
     , T1.[Fahrzeug]
     , T1.[Teile]
     , T1.[Fremdl.]
     , T1.[Umsatz Auftrag]
     , T1.[Tag_Dashboard]
     , T1.[Monat_Dashboard]
     , T1.[Jahr_Dashboard]
	 , T1.[Location Code]
	 , T2.[Hauptbetrieb_ID]
	 , T2.[Hauptbetrieb_Name]
	 , T2.[Standort_ID]
	 , T2.[Standort_Name]
	 , T2.[Branch ID]
FROM [transform].[Service_offene_Auftraege_neu_mit_Mont_Anzeige] T1
		LEFT OUTER JOIN [transform_basis].Location_Standort T2 ON T1.Client_DB = T2.Client_DB 
		AND T1.[Location Code] = T2.[Location Code]
WHERE T2.[Bestand] IS NULL OR T2.[Bestand] = '1'
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
