-1

I want to update column of one table from another table

UPDATE tbl_relations SET tbl_relations.WANTED = table_wanted.WANTED FROM table_wanted , tbl_relations  WHERE table_wanted.M_V_NO = tbl_relations.M_V_NO

And Error message in SQLite manager is

near ".": syntax error: 
halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Try the following (works for me in SQLite with fake data):

UPDATE tbl_relations
SET tbl_relations.WANTED = (SELECT w.WANTED 
                            FROM table_wanted w
                            WHERE w.M_V_NO = tbl_relations.M_V_NO) 
    WHERE tbl_relations.M_V_NO IN (SELECT w.M_V_NO
                                   FROM table_wanted w 
                                   WHERE w.M_V_NO = tbl_relations.M_V_NO)

Hope that helps.

Stidgeon
  • 2,673
  • 8
  • 20
  • 28