" 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 Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode \n"+
" left join set_backQty tt on temp1.Sap编码 = tt.MaterialCode and temp1.订货看板编号 = tt.Code ";
" LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode \n"+
" LEFT JOIN Set_material B ON a.MaterialCode = b.CustomerPartCode \n"+
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) d ON a.ParentSapMaterialCode = d.MaterialCode \n"+
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) d ON a.ParentSapMaterialCode = d.MaterialCode \n"+
" ) temp1\n"+
" ) temp1\n"+
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode";
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode \n"+
" left join set_backQty tt on temp1.SapMaterialCode = tt.MaterialCode and temp1.ChassisNumber = tt.Code ";
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
" LEFT JOIN(SELECT max(Id) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType) temp2 ON temp1.MaterialCode = temp2.MaterialCode ";
" LEFT JOIN(SELECT max(Id) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType) temp2 ON temp1.MaterialCode = temp2.MaterialCode ";