USE [TIM] GO /****** Object: View [dbo].[View_RPT_ThemaKommunikation] Script Date: 12.05.2013 10:10:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[View_RPT_ThemaKommunikation] AS SELECT dbo.Thema.Titel AS Thema, dbo.Kommunikation.Bezeichnung AS Kommunikation, dbo.Kommunikation.erstellt_am AS [Kommuikation erstellt_am], dbo.KommunkationAuspraegung.Bezeichnung AS Auspraegung, dbo.Zielgruppe.Bezeichnung AS Zielgruppe FROM dbo.Kommunikation INNER JOIN dbo.KommunkationAuspraegung ON dbo.Kommunikation.KommunikationNr = dbo.KommunkationAuspraegung.KommunikationNr INNER JOIN dbo.Thema ON dbo.Kommunikation.ThemaNr = dbo.Thema.ThemanNr LEFT OUTER JOIN dbo.KommunikationAuspraegung_Zielgruppe ON dbo.KommunkationAuspraegung.KommunikationAuspraegungNr = dbo.KommunikationAuspraegung_Zielgruppe.Kommunikationauspraegungnr LEFT OUTER JOIN dbo.Zielgruppe ON dbo.KommunikationAuspraegung_Zielgruppe.Zielgruppenr = dbo.Zielgruppe.ZielgruppeNr GO /****** Object: View [dbo].[View_RPT_Themenuebersicht] Script Date: 12.05.2013 10:10:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[View_RPT_Themenuebersicht] AS SELECT dbo.Thema.Titel, dbo.Thema.Beschreibung, dbo.Kategorie.Bezeichnung, dbo.Thema.Suchbegriffe, CASE WHEN dbo.Thema.Gueltig_ab < '01.01.1910' THEN NULL ELSE dbo.thema.gueltig_ab END AS Guelitg_ab, CASE WHEN dbo.Thema.Gueltig_bis < '01.01.1910' THEN NULL ELSE dbo.thema.gueltig_bis END AS Gueltig_bis, dbo.Kategorie.mutiert_am, dbo.Thema.erstellt_am FROM dbo.Thema INNER JOIN dbo.Kategorie ON dbo.Thema.KategorieNr = dbo.Kategorie.KategorieNr WHERE (dbo.Thema.aktiv = 1) GROUP BY dbo.Thema.Titel, dbo.Thema.Beschreibung, dbo.Kategorie.Bezeichnung, dbo.Thema.Suchbegriffe, dbo.Kategorie.mutiert_am, CASE WHEN dbo.Thema.Gueltig_ab < '01.01.1910' THEN NULL ELSE dbo.thema.gueltig_ab END, CASE WHEN dbo.Thema.Gueltig_bis < '01.01.1910' THEN NULL ELSE dbo.thema.gueltig_bis END, dbo.Thema.erstellt_am GO