Skip to main content
4 of 4
Incorporated comments
Paul White
  • 90.3k
  • 30
  • 424
  • 663

UPDATE & SELECT & INNER JOIN combined (SQL92) — How?

I have two tables with the following columns:

Table1
id 
Sort
dou

and

Table2
id_Table1
Sort

and I need to read all values of Table1.Sort where Table1.dou = 1 and write them into Table2.Sort, into those rows where Table2.id_Table1 matches the Table1.id values.

I can do: SELECT Sort FROM Table1 WHERE dou = 1

And I can do UPDATE Table2 SET Sort WHERE id_Table1 = 'uuid'

But how can I combine these in a way that all Table1.Sort values overwrite the Table2.Sort values?

In my version of SQL92 I can use INNER JOIN statements, but I don’t know how close it adheres to the standard. I have no idea this could work with an UPDATE statement.

I'm using FileMaker SQL engine.