" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n"+
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {1} GROUP BY kanban, MaterialCode ) AS a\n"+
" LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n"+
" LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n"+
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {1} GROUP BY kanban, MaterialCode ) AS a\n"+
" INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,Price FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode,Price ) AS b ON a.Kanban = b.HQHKanBan \n"+
" INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,Price FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode,Price ) AS b ON a.Kanban = b.HQHKanBan \n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n"+
" INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n"+
" LEFT JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n"+
" LEFT JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n"+