Identifying when there is more than 1 in a group based on grouped field
- by Brian Cascone
Sorry for the bad description it is tough to explain in one sentence.
I have a dataset that has Cause field (RootCause) and an ID field (GroupID). Both can be many things but I need to identify where a GroupID has a multiple different rootcauses.
for example:
RootCause GrpId
AAA 111
BBB 222
CCC 111
I am looking to be able to identify that GrpId 111 has two different RootCauses.
This is what I have so far:
Select [RootCause], GrpId, Count(GrpID) as CntGrpId
From DB.dbo.Table
Where DatatypeField <> ''
Group BY [RootCause],GrpId
This results set visualy gives me enough information to identify what I am looking for, but i need something better. I am looking to return only the ones that have multiples.
Any ideas? Thanks