(SQL Server 2000)
I'm setting up a column on the fly and giving it an alias name. I want to use the alias in the WHERE clause, but it's not working. My code: [ul]SELECT ProfileID, SUBSTRING(Fname,1,2) As "FnameCmpr"
FROM Profile
WHERE SSN = '123456789'
AND Lname = 'Doe'
AND FnameCmpr = 'Jo'[/ul] What I'm basically trying to do is compare the first two letters of the first name in the database (Fname) against a value I'm passing in. In the code above, the value 'passed in' is 'Jo'.
I'm setting up a column on the fly and giving it an alias name. I want to use the alias in the WHERE clause, but it's not working. My code: [ul]SELECT ProfileID, SUBSTRING(Fname,1,2) As "FnameCmpr"
FROM Profile
WHERE SSN = '123456789'
AND Lname = 'Doe'
AND FnameCmpr = 'Jo'[/ul] What I'm basically trying to do is compare the first two letters of the first name in the database (Fname) against a value I'm passing in. In the code above, the value 'passed in' is 'Jo'.