How can I use a column alias in a where clause?
-
Hello, I'd like some help on the following problem - I need to use an alias as a condition in the where clause: select field1, field2, field3, field1*field2-field3 as some_alias from table1 where some_alias between 10 and 20 Using an alias like that returns the following error: Invalid column name 'some_alias'. Could anyone propose a solution?
-
Hello, I'd like some help on the following problem - I need to use an alias as a condition in the where clause: select field1, field2, field3, field1*field2-field3 as some_alias from table1 where some_alias between 10 and 20 Using an alias like that returns the following error: Invalid column name 'some_alias'. Could anyone propose a solution?
Hi Dobromir, You can use the alias definition in the where clause. Here is your query modified:
select field1,
field2,
field3,
field1*field2-field3 as some_alias
from table1
where (field1*field2-field3) between 10 and 20Regards, Mehroz
-
Hi Dobromir, You can use the alias definition in the where clause. Here is your query modified:
select field1,
field2,
field3,
field1*field2-field3 as some_alias
from table1
where (field1*field2-field3) between 10 and 20Regards, Mehroz
thank you for your answer, but is'n this going to cause a recalculation of the value of the alias?