I am trying to use a selected field's named alias in a where clause, yet the database complains about being unable to find said field.
Query:
SELECT somefunction(myfield) as mytest, myotherfield as mytest2
FROM database.table
WHERE mytest IS NULL OR mytest2 IS NULL
Expectation: The db would simply test the result of somefunction(myfield)
or mytest
for being NULL
Result: The db cannot find mytest
or mytest2
Is there something i am missing; why would something like this not work?