I have a table for which I want to validate where each parent intermediary is also a parent to itself. I want to write a query to validate this...
COLUMN DATATYPE DESCRIPTION
IntermediaryPK int
SourceSystemID tinyint Intermediary source
IntermediaryID nvarchar(20) Intermediary ID
IntermediaryName nvarchar(200) Intermediary name
IntermediaryTypeID nvarchar(1) Intermediary type
ParentIntermediaryID nvarchar(20) Intermediary parent
IntermediaryTypePK tinyint Intermediary type
IntermediaryCategoryPK smallint Intermediary category
ParentIntermediaryPK int Parent intermediary PK
GrandParentIntermediaryPK int Grand parent intermediary PK
I want to write validation Query which should return invalid parents I If any..