UPDATE T_PUR_QUOTE SET FTURNSCOUNT = FTURNS WHERE FTURNSCOUNT = ' ';
UPDATE A SET FDEADLINE = (SELECT B.FENDDATE FROM T_PUR_INQUIRY B WHERE (B.FID = A.FID AND (A.FDEADLINE IS NULL))) FROM T_PUR_INQUIRYSUPPLIER A  WHERE EXISTS (SELECT 1 FROM T_PUR_INQUIRY B WHERE (B.FID = A.FID AND (A.FDEADLINE IS NULL)));
UPDATE A SET A.FENTRYCOUNT = B.FTURNS, A.FENTRYTURNS = B.FTURNS FROM T_PUR_INQUIRYSUPPLIER A, T_PUR_INQUIRY B WHERE B.FID = A.FID AND EXISTS (SELECT 1 FROM T_PUR_INQUIRY B WHERE (B.FID = A.FID AND A.FENTRYCOUNT = ' '));
UPDATE A SET FSUPPLIERBIZSTATUS = 'C' FROM T_PUR_INQUIRYSUPPLIER A  WHERE EXISTS (SELECT 1 FROM T_PUR_INQUIRYSUPPLIER B LEFT OUTER JOIN T_PUR_INQUIRY C ON B.fid = C.fid WHERE (((B.FENTRYID = A.FENTRYID AND A.FENTRYSTATUS = 'F') AND (C.FBIZSTATUS != 'E')) AND A.FSUPPLIERBIZSTATUS = ' '));
UPDATE A SET FSUPPLIERBIZSTATUS = 'B' FROM T_PUR_INQUIRYSUPPLIER A  WHERE EXISTS (SELECT 1 FROM T_PUR_INQUIRYSUPPLIER B LEFT OUTER JOIN T_PUR_INQUIRY C ON B.fid = C.fid WHERE ((((B.FENTRYID = A.FENTRYID AND (A.FENTRYSTATUS != 'F')) AND (C.FBIZSTATUS != 'E')) AND A.FSUPPLIERBIZSTATUS = ' ') AND (A.FENTRYSTATUS != ' ')));
UPDATE A SET FSUPPLIERBIZSTATUS = 'E' FROM T_PUR_INQUIRYSUPPLIER A  WHERE EXISTS (SELECT 1 FROM T_PUR_INQUIRYSUPPLIER B LEFT OUTER JOIN T_PUR_INQUIRY C ON B.fid = C.fid WHERE ((B.FENTRYID = A.FENTRYID AND C.FBIZSTATUS = 'E') AND A.FSUPPLIERBIZSTATUS = ' '));
UPDATE A SET FSCENERESULT = '1' FROM T_PUR_SCENE A  WHERE A.FSCENERESULT = '2';
UPDATE A SET FENTRYLOGSCOPE = (SELECT B.FSUPSCOPE FROM T_PUR_INQUIRY B WHERE B.fid = A.fid) FROM T_PUR_INQUIRYTURNSLOG A  WHERE EXISTS (SELECT 1 FROM T_PUR_INQUIRYTURNSLOG B LEFT OUTER JOIN T_PUR_INQUIRY C ON B.fid = C.fid WHERE (B.FENTRYID = A.FENTRYID AND B.FTURNS = '1'));
UPDATE A SET FENTRYLOGSCOPE = '2' FROM T_PUR_INQUIRYTURNSLOG A  WHERE (A.FTURNS IN ('2', '3', '4', '5'));
