" ( SELECT SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform WHERE version = '{0}' AND StorageLocationDesc NOT LIKE '%备品%' GROUP BY MaterialCode, Version ) A\n"+
"( SELECT SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform WHERE version = '{0}' AND StorageLocationDesc NOT LIKE '%备品%' GROUP BY MaterialCode, Version ) A\n"+
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
"LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode\n"+
" ) temp1\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 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"+
"LEFT JOIN (\n"+
" SELECT SUM\n"+
"SELECT\n"+
" ( Amt ) / SUM ( Qty ) AS Price,\n"+
"\n"+
" MaterialCode,\n"+
"case SUM(Qty) when 0 then 0 else\n"+
" Version \n"+
"SUM( Amt ) / SUM ( Qty )\n"+
" FROM\n"+
"\n"+
" Set_BT_Car_Platform \n"+
"end AS Price,\n"+
" WHERE\n"+
"MaterialCode,\n"+
" version = '{0}' \n"+
"Version\n"+
" AND StorageLocationDesc NOT LIKE '%备品%' \n"+
"FROM\n"+
" GROUP BY\n"+
"Set_BT_Car_Platform\n"+
" MaterialCode,\n"+
"WHERE\n"+
" Version \n"+
"version = '{0}'\n"+
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
"AND StorageLocationDesc NOT LIKE '%备品%'\n"+
"GROUP BY\n"+
"MaterialCode,\n"+
"Version\n"+
") AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode\n";
" ( SELECT SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform WHERE version = '{0}' AND StorageLocationDesc LIKE '%备品%' GROUP BY MaterialCode, Version ) A\n"+
"( SELECT SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform WHERE version = '{0}' AND StorageLocationDesc LIKE '%备品%' GROUP BY MaterialCode, Version ) A\n"+
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n"+
"LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode\n"+
" ) temp1\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 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"+
"LEFT JOIN (\n"+
" SELECT SUM\n"+
"SELECT\n"+
" ( Amt ) / SUM ( Qty ) AS Price,\n"+
"case SUM(Qty) when 0 then 0 else\n"+
" MaterialCode,\n"+
"\n"+
" Version \n"+
"SUM\n"+
" FROM\n"+
"( Amt ) / SUM ( Qty )\n"+
" Set_BT_Car_Platform \n"+
"end\n"+
" WHERE\n"+
"AS Price,\n"+
" version = '{0}' \n"+
"MaterialCode,\n"+
" AND StorageLocationDesc LIKE '%备品%' \n"+
"Version\n"+
" GROUP BY\n"+
"FROM\n"+
" MaterialCode,\n"+
"Set_BT_Car_Platform\n"+
" Version \n"+
"WHERE\n"+
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
"version = '{0}'\n"+
"AND StorageLocationDesc LIKE '%备品%'\n"+
"GROUP BY\n"+
"MaterialCode,\n"+
"Version\n"+
") AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode\n";