Why won't this sql update query work?

Posted by Wesley on Stack Overflow See other posts from Stack Overflow or by Wesley
Published on 2010-05-25T00:41:56Z Indexed on 2010/05/25 0:51 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

I have a table that has 5,000(table1) lines in it. Currently, 3,000 of them are filled up with data. The remaining values are currently null. In a separate table(table2), I have the remaining 2,000 rows of data. I am simply trying to take the values in table2 and put them in table1, but this statement isn't working:

Update table1
  Set field1 = (Select field1 
                  From table2 
                 Where table1.id = table2.id) 
Where Exists(Select field1 
               From table2 
              Where table1.id = table2.id)

It looks like this should be working, but I am getting an error from Base, the db program I am using that just says error Near " ": syntax error...any help?? Thanks!

© Stack Overflow or respective owner

Related posts about sql

Related posts about query