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