Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > CREATE TABLE dbo.bla(ID INT IDENTITY(1,1) PRIMARY KEY NOT NULL, > PartyId int, > OtherPartyId int, > RelType int, > RelStatus int); > GO > > <pre> > ✓ > </pre> <!-- --> > INSERT INTO dbo.Bla(PartyId , OtherPartyId , RelType , RelStatus) > VALUES > (1111,2211 ,1 ,1), > (2211,1111 ,1 ,1), > (3344,4444 ,1 ,2), > (5555,2224 ,1 ,2), > (4444,3344 ,2 ,2), > (1111,2211 ,2 ,2)-- different type or status > GO > > <pre> 6 rows affected > </pre> <!-- --> > SELECT PartyId , OtherPartyId, RelType , RelStatus > FROM dbo.Bla > EXCEPT > SELECT OtherPartyId , PartyId, RelType , RelStatus > FROM dbo.Bla; > GO > > <pre> > PartyId | OtherPartyId | RelType | RelStatus > ------: | -----------: | ------: | --------: > 1111 | 2211 | 2 | 2 > 3344 | 4444 | 1 | 2 > 4444 | 3344 | 2 | 2 > 5555 | 2224 | 1 | 2 > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=d96eb74446a3bd2cddf5bd0f40064a5b)*
back to fiddle