select g.goods_no, g.spec_wh_no,g.num_day,h.num_yesterday ,g.stock_num,g.subscribe_num,g.order_num,g.sending_num,g.purchase_num from (select f.goods_no, e.spec_id,e.num_day,e.spec_wh_no,e.stock_num,e.subscribe_num,e.order_num,e.sending_num,e.purchase_num from (select c.spec_id,c.num_day,d.spec_wh_no,d.stock_num,d.subscribe_num,d.order_num,d.sending_num,d.purchase_num from (select spec_id,num_day from stat_sales_summary where warehouse_id = 5 and to_days(sales_date) = to_days(now())) c left join (select spec_id,spec_wh_no,stock_num,subscribe_num,order_num,sending_num,purchase_num from stock_spec where warehouse_id = 5) d on c.spec_id = d.spec_id)e left join (select b.spec_id,goods_no from goods_goods a left join goods_spec b on a.goods_id = b.goods_id)f on e.spec_id = f.spec_id )g left join (select spec_id,num_day as num_yesterday from stat_sales_summary where warehouse_id = 5 and to_days(sales_date) = to_days(now())-1)h on g.spec_id = h.spec_id |