I’m learning SQL, so please bear with me. I was wondering if the following is possible, and if so, how do you reference previous selections?
SELECT [col1] as something1, [col2] as something2,
<Can I use something1 or something2 in the third selection?>
FROM [MyTable]
WHERE <Condition>
Per this answer I do not think that this will work in SQL Server.
If you really need to use the aliases you can do:
Or more simply just type the full column name whenever you need it: