I think this is what you're looking for...
Providing easily consumable sample data makes it easier for people to help and more likely...
--Setup Sample Data
declare @transactions as table (Receivers char(1), Payers char(1))
insert into @transactions(Receivers, Payers)
values('A' , 'A')
,('B' , 'A')
,('A' , 'B')
,('A' , 'D')
,('B' , 'D')
,('C' , 'A')
,('B' , 'E')
,('A' , 'E')
--Actual work statement
select distinct [Group]
from (
select Receivers [Group]
from @transactions
union all
select Payers [Group]
from @transactions
) c
---------------------------------------------------------------
Mike Hahn - MCSomething someday:-)
Right way to ask for help!!
http://www.sqlservercentral.com/articles/Best+Practices/61537/
I post so I can see my avatar :hehe:
I want a personal webpage 😎
I want to win the lotto 😀
I want a gf like Tiffa :w00t: Oh wait I'm married!:-D