I’m trying to put two strings in my columns VALUE01 and VALUE02 together and then search if a search string exists in this new column. I tried both of the statements below. I get error saying “Invalid column name ‘Complete'”. What is wrong with these statements? I Use MS SQL Server.
SELECT COALESCE(VALUE01, '') + COALESCE(VALUE02, '') AS Complete FROM dbo.Data WHERE Complete LIKE 'Test'"
SELECT (VALUE01 + VALUE02) AS 'Complete' FROM dbo.Data WHERE Complete LIKE 'Test'"
You can’t use column alias in
WHEREclause.Try: