how to Use created SQL variable in the same query

14 Views Asked by At

I have the following query:

   SELECT target,
   
   CASE
       WHEN var_10 >1.5 AND var_10 <2.5 THEN 1 
   END as var_10_bck,

Then I want to use this new created variable "var_10_bck" in the same query that continues as :

   CASE
       WHEN var_10_bck <2 THEN 0
   END as var_10_new

   FROM database
0

There are 0 best solutions below