Thanks to anyone who replied to this. As it turns out I had to build a couple of sub-queries to achieve what I wanted. The bottom most sub-query returns the nomenclature map results when both ICD9 codes are present via
NMC.CodeID = AbsDrgDiagnoses.Diagnosis.
Now this was my problem, I didn't know that you could include an AND statement within the sub-query when it was returning a single result from another sub-query, learned something new! Thus I could only return the CodeSetID of 'SNOMED_CT' and not the actual CodeID of 5510009. By putting in
WHERE NMC.CodeSetID = 'SNOMED_CT' AND NMC.MisNomenclatureMapID IN
I was then able to return the value needed.
CODE:
,COALESCE((SELECT NMC.CodeID
FROM DMisNomenclatureMapCodes NMC
WHERE NMC.CodeSetID = 'SNOMED_CT' AND NMC.MisNomenclatureMapID IN
(SELECT NMC.MisNomenclatureMapID
FROM DMisNomenclatureMapCodes NMC
WHERE (NMC.CodeID = AbsDrgDiagnoses.Diagnosis)
)
),'') AS SNOSet_TEST