Try to search your question here, if you can't find : Ask Any Question Now ?

Reference Temp Column in INNER JOIN

HomeCategory: stackoverflowReference Temp Column in INNER JOIN
pragati asked 2 weeks ago

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 CustomerNumber

Does anyone know how to use a temp field to help make this inner join work so I can get the data I need?

1 Answers
Best Answer
Fernando answered 2 weeks ago
Your Answer

9 + 13 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com