Update + Select

UPDATE pnc SET pnc.status = 3 from pc_nc_case pnc WHERE pnc.pc_nc_case_id  = (SELECT TOP 1 pnch.pc_nc_case_id FROM

pc_nc_case_history pnch WHERE pnc.pc_nc_case_id = pnch.pc_nc_case_id AND pnch.status=3 ORDER BY pnch.pc_nc_case_history_id DESC)

AND pnc.status = 1

--婚姻狀況
update m set m.marr_status=d.id from member m left join  center_dict d on d.dict_id=m.marr_status and m.center_id=d.center_id

你可能感兴趣的:(select)