Skip to content
Advertisement

using alias to where clause query mysql

i have query

but mysql showing this error:

Unknown column 'Aktifitas' in 'where clause'

why mysql Alias cant be use in Where clause, but is there something I missing?

Thanks in advance.

Advertisement

Answer

You can’t use column’s alias in where clause you must repeat the code

(because the where clause is executed before of the select clause and for this reason the alias name is not know by the where clause )

eventually you can filter the result using having

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement