SELECT product_id, FORMAT(IFNULL(SUM(if_click)/NULLIF(COUNT(*),0),0),3) as ctr, FORMAT(IFNULL(SUM(if_cart)/NULLIF(SUM(if_click),0),0),3) as cart_rate, FORMAT(IFNULL(SUM(if_payment)/NULLIF(SUM(if_cart),0),0),3) as payment_rate, FORMAT(IFNULL(SUM(if_refund)/NULLIF(SUM(if_payment),0),0),3) as refund_ra...