" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" \n"+
" WHERE\n"+
" a.Version= '{0}' \n"+
" AND a.StorageLocationDesc NOT LIKE '%备品%'\n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n"+
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" WHERE\n"+
" a.Version= '{0}' \n"+
" AND a.StorageLocationDesc NOT LIKE '%备品%' \n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n"+
" LEFT JOIN (\n"+
" SELECT SUM\n"+
" ( Amt ) / SUM ( Qty ) AS Price,\n"+
" MaterialCode,\n"+
" Version \n"+
" FROM\n"+
" Set_BT_Car_Platform \n"+
" WHERE\n"+
" version = '{0}' \n"+
" AND StorageLocationDesc NOT LIKE '%备品%' \n"+
" GROUP BY\n"+
" MaterialCode,\n"+
" Version \n"+
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n"+
" LEFT JOIN (\n"+
" SELECT SUM\n"+
" ( Amt ) / SUM ( Qty ) AS Price,\n"+
" MaterialCode,\n"+
" Version \n"+
" FROM\n"+
" Set_BT_Car_Platform \n"+
" WHERE\n"+
" version = '{0}' \n"+
" AND StorageLocationDesc NOT LIKE '%备品%' \n"+
" GROUP BY\n"+
" MaterialCode,\n"+
" Version \n"+
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" \n"+
" WHERE\n"+
" a.Version= '{0}' \n"+
" AND a.StorageLocationDesc LIKE '%备品%'\n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n"+
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" WHERE\n"+
" a.Version= '{0}' \n"+
" AND a.StorageLocationDesc LIKE '%备品%' \n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) AS b ON a.Kanban = b.HQHKanBan \n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" WHERE\n"+
" b.HQHKanBan IS NULL \n"+
" AND b.MaterialCode IS NULL {0} \n"+
" ) AS temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode";
" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) AS b ON a.Kanban = b.HQHKanBan \n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" WHERE\n"+
" b.HQHKanBan IS NULL \n"+
" AND b.MaterialCode IS NULL {0}\n"+
" ) AS temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode";
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" ) temp1\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
//" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" ) temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
// var _sql = string.Format(str, version, condition);