Updating Multiple Tables with single Update query I have two tables TableA, TableB as follows.

Table "db3004db.tableb"

 Column  |  Type   | Collation | Nullable | Default 
---------+---------+-----------+----------+---------
 empid   | integer |           | not null | 
 salaryb | integer |           | not null | 

Indexes:
    "tableb_pk" PRIMARY KEY, btree (empid)


Table "db3004db.tablea"

 Column |  Type   | Collation | Nullable | Default 
--------+---------+-----------+----------+---------
 empid  | integer |           | not null | 
 salary | integer |           | not null | 

Indexes:
    "tablea_pk" PRIMARY KEY, btree (empid)


Before Update:

select * from tableA;

 empid | salary 
-------+--------
     1 |   1004
     2 |   2007

select * from tableB;

 empid | salaryb 
-------+---------
     1 |       0
     2 |       0


Expected Update Query:

set tableB.salary=tableA.salary%1000, 
    tableA.salary= tableA.salary/1000 
where (tableA.pk = tableB.pk)


After update:

select * from tableA;

 empid | salary 
-------+--------
     1 |   1
     2 |   2

select * from tableB;

 empid | salaryb 
-------+---------
     1 |       4
     2 |       7


I'm interested in doing this update in Postgres (with single update statement)? If possible , is this query compatible with SQL standard?
WITH cte 
AS ( UPDATE tableB 
     SET salaryb = tableA.salary % 1000 
     FROM tableA 
     WHERE tableB.empid = tableA.empid
     RETURNING *
   )
UPDATE tableA
SET salary = salary / 1000;