select product_id,round((click/ct),3) as ctr,round((cart/click),3) as cart_rate,round((pay/cart),3) as payment_rate, round((refund/pay),3) as refund_rate from 
(select product_id,count(product_id) as ct ,sum(if_click) as click,
sum( if_cart) as cart , sum(if_payment) as pay,sum(if_refund) as refund
from tb_user_event
where month(date(event_time))=10
group by product_id) a
where round((refund/pay),3)<=0.5
order by product_id