Using alias in query and using it
I have a doubt and question regarding alias in sql. If i want to use the alias in same query can i use it. For eg: Consider Table name xyz with column a and b select (a/b) as temp , temp/5 from xyz Is this possible in some way ? You are talking about giving an identifier to an expression in a query and then reusing that identifier in other parts of the query? That is not possible in Microsoft SQL Server which nearly all of my SQL experience is limited to. But you can however do the following. SELECT temp, temp / 5 FROM ( SELECT (a/b) AS temp FROM xyz ) AS T1 Obviously that example isn't