Click here to Skip to main content
15,882,464 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
How can I referenc an Aliased Column in the WHERE Clause in sql server??
Posted
Comments
[no name] 17-Dec-13 0:31am    
Thanks,I also got it....

select * from
(Select Colmn1 as C1, Colmn2 as C2 from Table)T
where C1='XYZ'

You can try this.
 
Share this answer
 
As per my knowledge, you can only use column aliases in GROUP BY, ORDER BY, or HAVING clauses.

but you can an achieve it in another way like you have to define select statement inside a table and then you can make use if it

WITH tempTable AS
(
SELECT something AS something
FROM TransactionTable
)
SELECT *
FROM tempTable
WHERE something > 5
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900