Error Code: 1054. Unkowm column

2

I want to query a value from an account I made in SQL:

(Valor - (select Visibilidade)) AS Diferenca

When I try to query:

Diferenca <= 500

It displays the following error:

Error Code: 1054. Unknown 'Diferenca' in 'where clause'
    
asked by anonymous 19.09.2017 / 20:37

1 answer

2

You can not use the alias in the where clause instead, instead, query:

select suasColunas from suaTabela where (Valor - (select Visibilidade)) <= 500
    
19.09.2017 / 21:19