I am having the following problem. I want to execute as sql statement that filters the results with HAVING. However the having is on a column that is calculated from an IF() function inside the select. This way, MySQL server complains that the column inside having clause is unknown!
EX:
SELECT col1,col2,IF(expr1,expr2,expr3) AS `wantedColumn`
FROM....
WHERE ...
HAVING LENGTH(`wantedColumn)>0
It is as mysql cannot understand that the column returned by the if expression is named wantedColumn... If I use other columns it is working correctly. But I need to filter on that. Any suggestions? Thanks
Aucun commentaire:
Enregistrer un commentaire