stringstr="SELECT MAX(B.EndTime) EndTime ,a.PoBillNum ,a.site,max(B.Version) AS Version FROM V_TB_PO A INNER JOIN V_TB_PO_PLAN_EXTEND B ON A.PoBillNum = B.PoBillNum AND B.AskBillNum <> '' and a.Site = b.Domain GROUP BY A.PoBillNum,a.Site";
stringstr="SELECT MAX(A.EndTime) EndTime ,A.PoBillNum ,Domain AS SITE,max(Version) AS Version\n"+
" FROM [TB_PO_PLAN_EXTEND] A left join TB_ASK B ON A.PoBillNum=B.PoBillNum AND A.Domain=B.Site and A.EndTime=B.EndTime\n"+
" where A.IsDeleted=0 AND B.IsDeleted=0 AND B.AskBillNum<>'' group by A.PoBillNum, a.Domain";