Do you care which of the three doesn't match? If not - you could use JUST the "matches" part below
;with JoinMath as (
Select a.recordid, a.tempcheckid,
case when A.I_desc = B.I_desc then 1 else 0 end +
case when A.m_desc = B.m_desc then 1 else 0 end +
case when A.item = B.item then 1 else 0 end as Matches,
--create a pseudo bitbucket
case when A.I_desc = B.I_desc then 1 else 0 end +
case when A.m_desc = B.m_desc then 2 else 0 end +
case when A.item = B.item then 1 else 0 end as MatchFilter
From #tempcheck a
inner join #tempcheck b on a.recordID=b.recordID and a.tempcheckID<>a.tempcheckid
)
Select *,
case
when MatchFilter & 1 = 0 then 'Type1'
when MatchFilter & 2 = 0 then 'Type4'
when MatchFilter & 4 = 0 then 'Type3'
ELSE 'Type2'
end as MatchType
from JoinMath
where Matches>1
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?