" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode WHERE temp1.[交货单号] is not null ";
var_sql=string.Format(str,version,condition);
varsql2="SELECT\n"+
" a.WmsBillNum,\n"+
" a.MaterialCode,\n"+
" a.Kanban \n"+
"FROM\n"+
" Set_HQ_H_Kanban A\n"+
" INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n"+