with t1 as ( select q3.product_id as product_id, in_price, price, if(status =2 ,-cnt,cnt) as cnt, quantity, price * cnt as sr from tb_product_info as q1 join tb_order_detail as q3 on q1.product_id = q3.product_id join tb_order_overall as q2 on q2.order_id = q3.order_id where shop_id = 901 and DATE_F...