TeAmEr
TeAmEr

Reputation: 4773

Cross database update?

is it possible to update proj_oct.writings set proj_oct.writings.writer_id=jozad_bkb.elx_content.writer where proj_oct.writings.id=jozad_bkb.elx_content.id ??

it gives me Unknown column 'jozad_bkb.elx_content.id' in 'where clause' but it exists .

Thank you .

Edit :

copied the table to same database , this fails :
UPDATE writings SET writer_id = elx_content.writer WHERE id = elx_content.id

Upvotes: 1

Views: 1608

Answers (2)

TeAmEr
TeAmEr

Reputation: 4773

Found the solution :

update `elx_content` as x , writings as y set y.writer_id =x.writer  where y.id=x.id

Upvotes: 2

ethrbunny
ethrbunny

Reputation: 10469

Change it to an update/select:

UPDATE writings SET writer_id = select writer from elx_content WHERE writings.id = elx_content.id

Upvotes: 2

Related Questions