clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3799380 fiddles created (41684 in the last week).

CREATE TABLE dbo.bla(ID INT IDENTITY(1,1) PRIMARY KEY NOT NULL, PartyId int, OtherPartyId int, RelType int, RelStatus int);
 hidden batch(es)


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
6 rows affected
6 rows affected
 hidden batch(es)


SELECT PartyId , OtherPartyId, RelType , RelStatus FROM dbo.Bla EXCEPT SELECT OtherPartyId , PartyId, RelType , RelStatus FROM dbo.Bla;
PartyId OtherPartyId RelType RelStatus
1111 2211 2 2
3344 4444 1 2
4444 3344 2 2
5555 2224 1 2
PartyId OtherPartyId RelType RelStatus
1111 2211 2 2
3344 4444 1 2
4444 3344 2 2
5555 2224 1 2
 hidden batch(es)