I have 2 tables with product reference codes that are then merged into one table column alias using the following statement...
SELECT CASE RefCode1 WHEN '' THEN RefCode2 ELSE RefCode1 END AS NewRefCode
This works fine by itself until i then need to filter the "NewRefCode" column, i can't use the WHERE NewRefCode = 'Example' statement without generating an error as it's not a real column.
Is there a way around this without using something like WHERE Refcode1 OR Refcode2 = 'Example'
Thanks