I have this code here:
SELECT c.Case_Code,COALESCE(c.case1, c.case2) AS case_def,aspm.UserId
FROM Cases AS c
LEFT JOIN aspnet_Membership AS aspm
ON c.case_def = aspm.userId
And well, since there is an Alias in the On clause, it won't recognize the case_def.
What i need to do is, i need to take the non null value between case1 and case2 and i need to Left Join it as i do in my query.
How do i do this? Thanks in advance.