First it should be easy for the DB'es but its really giving me pain here i dont know why ,,
I have two tables , [Table1] named Applicationforms and [Table2] named WFInstance i need to update the FormSubmitDate in Table1 with the startedDate value in table 2 where the FormSubmitDate is null. I write the following query
UPDATE ApplicationForm
SET FormSubmitDate = wfi.StartDate
FROM ApplicationForm app ,
WorkFlowInstances wfi
WHERE app.FormSubmitDate is null and wfi.applicationID = app.ID
when i run the query the SQL regenerate the query to this one,,
UPDATE ApplicationForm
SET FormSubmitDate = wfi.StartDate
FROM ApplicationForm AS app INNER JOIN
WorkFlowInstances AS wfi ON app.ID = wfi.ApplicationID CROSS JOIN
ApplicationForm
WHERE (app.FormSubmitDate IS NULL)
I tried to write another statment using join ,,
UPDATE ApplicationForm
SET FormSubmitDate = wfi.StartDate
FROM ApplicationForm
JOIN WorkFlowInstances wfi ON ApplicationForm.ID = wfi.ApplicationID
WHERE FormSubmitDate is null
and the SQL generate the same new syntax,,
now when i run the code , [all records] formSubmitDate fields filled with the first value of second table startDate. even if i have one record contains null value in table1
What i am missing here !?