; With ids as (
Select distinct FBILLID, FBILLSEQ from # t where FBILLFORMID='PRD_PICKMTRL'
)
,
Bills as (
Select BILL. FID, BILL. FSEQ project. FNAME AS F_PXJT_PROJECTNAME, differ. FNAME AS F_PXJT_BusinessName, BILL. F_PXJT_ClientPO
The FROM T_PRD_PICKMTRLDATA BILL
The JOIN ids on bill. FID=ids. FBILLID and bill. FSEQ=ids. FBILLSEQ
Left the JOIN PXJT_t_ProJect_L project ON the project. The FID=bill. F_PXJT_PROJECTID
Left the join PXJT_DB_DifferServ_L differ on differ. FID=bill. F_PXJT_BUSINESSID
)
UPDATE the SET S F_PXJT_ProjectName=bills. F_PXJT_ProjectName F_PXJT_BusinessName=bills. F_PXJT_BusinessName, F_PXJT_ClientPO=bills. F_PXJT_ClientPO
The from # t S join billS on s. BILLID=billS. FID and s. BILLSEQ=billS. FSEQ
The main table data is more, with the join took more than a minute, into a left join it only takes a few seconds, why the gap is so big
CodePudding user response:
First, two kinds of writing are equivalentSecond, take a look at is how to get to the execution plan,