mysql - Having condition has unknown clause -


 select sum(pa.depositmade_num) numdeposit, sum(pa.depositmade_amt) amtdeposit,      count(distinct pa.userid) distinctuser  customer_profile cp  inner join player_activity pa     on cp.userid = pa.userid  pa.txndate > date(curdate()) - interval 14 day having (select (round(sum(opa.totalhold - opa.playercomps - opa.freemoney                          - (opa.depositmade_amt*.1)),2)) > 20000                         player_activity opa                         opa.userid = cp.userid)  

i have used same having statement in other queries without issue in mysql.

however, i'm getting unknown column datawarehouse.cp.userid in clause error message.

when remove where opa.userid = cp.userid having sub-query, query runs. need line calculation work properly.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -