Mysql Select Subquery where clause subquery equal alias ( AS subquery named ) I'am tired looking for this issue on internet, I don't know what a keyword for search for that, and I can`t find same issue for my issue.

Ok to the point. 

select id, name,

(select count(tableB.id) from tableB where tableB.id_tableA = tableA.id) as haveBonA,

(select count(tableC.id) from tableC where tableC.id_tableA = tableA.id) as haveConA,

IF(haveBonA=haveConA,"Equal","Not Equal") AS equalTableBTableC

from tableA;


If this query run output error : Unknown column 'haveBonA' in 'field list'

I don't know how to express it. and I'm sorry, can't speak english.
Thank Your.

SOLVED

select id, name,

(select count(tableB.id) from tableB where tableB.id_tableA = tableA.id) as haveBonA,

(select count(tableC.id) from tableC where tableC.id_tableA = tableA.id) as haveConA,

(select (IF(haveBonA=haveConA,"Equal","Not Equal") AS equalTableBTableC)

from tableA;


I change to (select (IF(haveBonA=haveConA,"Equal","Not Equal") AS equalTableBTableC)
Thank you for all answering.
You can try this

with t1 as (
select id, name,
(select count(tableB.id) from tableB where tableB.id_tableA = tableA.id) as 
haveBonA,
(select count(tableC.id) from tableC where tableC.id_tableA = tableA.id) as 
haveConA
from tableA
)

select t1.*,
   case
   when t1.haveBonA = t1.haveConA then "Equal"
   else "Not Equal"
   end equalTableBTableC
from t1
where 1=1