UPDATE t_pur_quote SET fturnscount = FTURNS WHERE FTURNSCOUNT = ' ';
UPDATE t_pur_inquirysupplier a SET fdeadline = (SELECT FENDDATE FROM t_pur_inquiry WHERE (FID = A.FID AND (A.FDEADLINE IS NULL))) WHERE EXISTS (SELECT 1 FROM t_pur_inquiry WHERE (FID = A.FID AND (A.FDEADLINE IS NULL)));
UPDATE t_pur_inquirysupplier a SET fentrycount = B.FTURNS, fentryturns = B.FTURNS FROM t_pur_inquiry b WHERE EXISTS (SELECT 1 FROM t_pur_inquiry WHERE (FID = A.FID AND A.FENTRYCOUNT = ' ')) AND B.FID = A.FID;
UPDATE t_pur_inquirysupplier a SET fsupplierbizstatus = 'C' 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 t_pur_inquirysupplier a SET fsupplierbizstatus = 'B' 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 t_pur_inquirysupplier a SET fsupplierbizstatus = 'E' 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 t_pur_scene a SET fsceneresult = '1' WHERE A.FSCENERESULT = '2';
UPDATE t_pur_inquiryturnslog a SET fentrylogscope = (SELECT B.FSUPSCOPE FROM t_pur_inquiry b WHERE B.fid = A.fid) 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 t_pur_inquiryturnslog a SET fentrylogscope = '2' WHERE A.FTURNS IN ('2', '3', '4', '5');
