As you can see I am geting the same result but as I am requesting this information from the same view: idmv_link_ext so different mcUniqueID in the both request.
Another point is to use UNION I have to remove all my headers I want to get the delta and keep only: mcOtherMSKEYVALUE
Here is my SQL:
--SQL1
SELECT
UR.mcUniqueID MSKEYVALUE, UR.mcThisMSKEY MskeyUser, UR.mcThisMSKEYVALUE Users, UR.mcOtherMSKEYVALUE UserRoles, PR.mcThisMSKEYVALUE UserPrivileges,
UR.mcAssignedDirect isDirect
FROM idmv_link_ext2 UR inner join idmv_link_ext2 PR on UR.mcOtherMSKEY = PR.mcOtherMSKEY
WHERE UR.mcThisOcName='MX_PERSON'
AND UR.mcOtherOcName='MX_ROLE'
AND PR.mcThisMSKEYVALUE like 'PRIV:%'
AND UR.mcThisMSKEYVALUE='3003'
-- SQL2
SELECT
mcUniqueID, mcThisMSKEYVALUE, mcOtherMSKEYVALUE
FROM idmv_link_ext2 with (nolock)
WHERE mcThisOcName='MX_PERSON'
AND mcOtherOcName='MX_PRIVILEGE'
AND mcLinkState=0
AND mcOtherMSKEYVALUE not like 'PRIV:SYSTEM%'
AND mcThisMSKEYVALUE='3003'
Any other method to get the delta with the other columns?
Nina