USE [DD_ECM]
GO

/****** Object:  View [dbo].[VWCUST_USER_REPRESENTATION]    Script Date: 21.03.2024 15:56:45 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

/****** Skript für SelectTopNRows-Befehl aus SSMS ******/

-- Stand: MK // 17.09.2021
-- 17.09.2021 - initial

CREATE view [dbo].[VWCUST_USER_REPRESENTATION] 
as

SELECT 
		 [TBDD_USER_REPRESENTATION].[GUID]
		,[USER_ID]
		,[TBDD_USER].[USERNAME]  as [USERNAME]
		,[REPR_USER]
		,[REPR_GROUP]
		,[REPR_GROUP].[NAME]	 as [REPR_GROUPNAME]
		,[RIGHT_GROUP]
		,[RIGHT_GROUP].[NAME]	 as [RIGHT_GROUPNAME]
		,[TBDD_USER_REPRESENTATION].[ADDED_WHO]
		,[TBDD_USER_REPRESENTATION].[ADDED_WHEN]
		,[TBDD_USER_REPRESENTATION].[CHANGED_WHO]
		,[TBDD_USER_REPRESENTATION].[CHANGED_WHEN]

  FROM [DD_ECM].[dbo].[TBDD_USER_REPRESENTATION]
  INNER JOIN  [TBDD_USER]                  ON [TBDD_USER_REPRESENTATION].[USER_ID]     = [TBDD_USER].[GUID]
  LEFT JOIN [TBDD_GROUPS] as [REPR_GROUP]  ON [TBDD_USER_REPRESENTATION].[REPR_GROUP]  = [REPR_GROUP].[GUID]
  LEFT JOIN [TBDD_GROUPS] as [RIGHT_GROUP] ON [TBDD_USER_REPRESENTATION].[RIGHT_GROUP] = [RIGHT_GROUP].[GUID]
GO


