sql server - Update column from another join column ,, -
first should easy db'es giving me pain here dont know why ,,
i have 2 tables , [table1] named applicationforms , [table2] named wfinstance need update formsubmitdate in table1 starteddate value in table 2 formsubmitdate null. write following query
update applicationform set formsubmitdate = wfi.startdate applicationform app , workflowinstances wfi app.formsubmitdate null , wfi.applicationid = app.id
when run query sql regenerate query one,,
update applicationform set formsubmitdate = wfi.startdate applicationform app inner join workflowinstances wfi on app.id = wfi.applicationid cross join applicationform (app.formsubmitdate null)
i tried write statment using join ,,
update applicationform set formsubmitdate = wfi.startdate applicationform join workflowinstances wfi on applicationform.id = wfi.applicationid formsubmitdate null
and sql generate same new syntax,,
now when run code , [all records] formsubmitdate fields filled first value of second table startdate. if have 1 record contains null value in table1
what missing here !?
i think want. try , let know.
update tabl3 set formsubmitdate=(select startdate table4 table4.id=tabl3.id , tabl3.formsubmitdate null);
another way write same thing be
update tabl3 set formsubmitdate= startdate table4 tabl3.id = table4.id , formsubmitdate null
Comments
Post a Comment