Hello I am using SQL 2012 and trying to identify rows where the SourceDataID column has two unique entries in the PartyCode column and having difficulties
SELECT PartyCode, SourceDataID, count (*) as CNT
FROM CustomerOrderLocation (nolock)
GROUP BY PartyCode, SourceDataID
HAVING (Count(PartyCode)>1)
ORDER BY PartyCode
Results are returning as such:
W3333 948_O 31 (party code/sourcedataid/CNT)
This is showing me the total entries where the Partycode and the SourceDataID are listed together in the table; However I need it to show a count of any instances where W333 lists 948_O as the SourceDataID more than once.
I'm not having luck structuring the query to pull the results I am looking to get.
Aucun commentaire:
Enregistrer un commentaire