0

I have a statement where i want to use the value of alias in my sql statement . How can i use this. Is there any possible way to use the alias value.

 SELECT ORDERID ,clientnum,ID, READYDATE, case when ID=56 then 'O' ELSE CASE when ID=65 then 'A' ELSE 'NONE' END END AS LOctaion -- want to use this alias below in where clause from orde_ where READYDATE='2014-05-09' AND LOctaion='A' 

Is this possible how can i do this . Thanks for your comments

1

1 Answer 1

2

You could do this:

SELECT * FROM ( SELECT ORDERID , clientnum, ID, READYDATE, ( case when ID=56 then 'O' ELSE CASE when ID=65 then 'A' ELSE 'NONE' END END) AS LOctaion from orde_ ) AS tbl where tbl.READYDATE='2014-05-09' AND tbl.LOctaion='A' 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.