views:

20

answers:

1

This pseduocode (inaccurate SQl) shows what I want to do.

update tableA (colA, colB, colC, colD)
select b.colA, b.colB, c.colC, c.colD
from tableB b 
    left outer join tableC c 
       on b.id = c.id
    inner join tableA a 
       on c.myNum = a.myNum 
    inner join tableD 
        on a.newId = f.newId
where f.imported = 1

How can I do this in a syntactically correct fashion?

+2  A: 

Something like this:

UPDATE TABLE 
SET ...
FROM Table1, Table2 ....
WHERE .....


update tableA 
 Set a.ColA = b.ColA,
     a.Colb = b.ColB,
     a.ColC = c.Colc,
     a.ColD = c.ColD
from tableB b 
 left outer join tableC c 
   on b.id = c.id
 inner join tableA a 
   on c.myNum = a.myNum 
 inner join tableD 
    on a.newId = f.newId
 where f.imported = 1
Michael Pakhantsov