isnull(sx.GoodQty, 0) as sx_good, isnull(sx.BadQty, 0) as sx_bad, isnull(sxtoday.qty, 0) as sx_today, isnull(sxyesterday.qty, 0) sx_yesterday, 0 - (isnull(sx.GoodQty, 0) - isnull(sxtoday.qty, 0) + isnull(sxyesterday.qty, 0) - isnull(jt.GoodQty, 0) - isnull(jt.BadQty, 0)) as sx_difference, isnull(jt.GoodQty, 0) as jt_good, isnull(jt.BadQty, 0) as jt_bad, isnull(jttoday.qty, 0) as jt_today, isnull(jtyesterday.qty, 0) jt_yesterday, 0 - (isnull(jt.GoodQty, 0) - isnull(jttoday.qty, 0) + isnull(jtyesterday.qty, 0) - isnull(ph.GoodQty, 0) - isnull(ph.BadQty, 0)) as jt_difference, isnull(ph.GoodQty, 0) as ph_good, isnull(ph.BadQty, 0) as ph_bad, isnull(phtoday.qty, 0) as ph_today, isnull(phyesterday.qty, 0) ph_yesterday, 0 - (isnull(ph.GoodQty, 0) - isnull(phtoday.qty, 0) + isnull(phyesterday.qty, 0) - isnull(zj.GoodQty, 0) - isnull(zj.BadQty, 0)) as ph_difference, isnull(zj.GoodQty, 0) as zj_good, isnull(zj.BadQty, 0) as zj_bad from @ProductIDList as a, finishedproduct as b, yuancaiFlow_view as hj, basflowsubsistence as hjtoday, basflowsubsistence as hjyesterday, yuancaiFlow_view as sx, basflowsubsistence as sxtoday, basflowsubsistence as sxyesterday, yuancaiFlow_view as jt, basflowsubsistence as jttoday, basflowsubsistence as jtyesterday, yuancaiFlow_view as ph, basflowsubsistence as phtoday, basflowsubsistence as phyesterday, yuancaiFlow_view as zj where a.productid = b.productid |