I have a temp column called
CFADTemp that I am trying to use in a inner join to help me match up data from a different table.
SELECT CustomerNumber, AddressLine1, AddressLine2, AddressLine3 FROM CFAddress A INNER JOIN (SELECT CustomerNumber, AddressType, MAX((CASE WHEN AddressType = '3' THEN '4' WHEN AddressType = '1' THEN '3' WHEN AddressType = '4' THEN '2' WHEN AddressType = '2' THEN '1' END) AS CFADTemp FROM CFAddress GROUP BY CustomerNumber, AddressType) B ON B.CustomerNumber = A.CustomerNumber AND...
I need to join with
CFADTemp and with the case when situation, not only with
Does anyone know how to use a temp field to help make this inner join work so I can get the data I need?