Search code examples
sqlorientdbnosql

Update two tables in a single query


How to update multiple tables in a orientdb using single query?

Looking for something like this

UPDATE table1, table2
    SET table1.col = a,
         table2.col2 = b
    WHERE table1.id = table2 .id;

Solution

  • You can't update multiple tables in one statement, however, you can use a transaction to make sure that two UPDATE statements are treated atomically. You can also batch them to avoid a round trip.