Hi,I have members that belongs to different group and other member can be in more than one group but in Hierarchy.I.E Group One, these members are only found in this groupGroup Two, Some, not all, of these members can also be found in Group OneGroup Three, Some, not all, of these members can also be found in Group TwoGroup Four, Some, not all, of these members can also be found in Group ThreeAll of these are found in these three Tables,[quote]CREATE TABLE [dbo].[Groups]( [GroupID] [tinyint] NOT NULL, [GroupName] [varchar](50) NOT NULL )CREATE TABLE [dbo].[Subscriptions]( [SubscriptionID] [bigint] IDENTITY(1000,1) NOT NULL, [Status] [int] NOT NULL, [StartDate] [datetime] NULL, [ActivationDate] [datetime] NULL, [EndDate] [datetime] NULL, [PersonID] [bigint] NULL, [GroupID] [tinyint] NULL)CREATE TABLE [dbo].[HD_PERSON]( [PersonID] [bigint] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](100) NULL, [LastName] [varchar](200) NULL)[/quote]So if I join these table and SELECT DISTINCT, if PersonID from GROUP 2 is also in Group 1, that person will also be returned. So I want all PersonID in that Hierarchy, All of Group 1 members, the Group 2 but not in Group until the last Group.Please help
↧