Reputation: 7479
In MySQL
, I have three different databases -- let's call them A
, B
and C
.
Is it possible to perform a transaction involving tables that are in all three databases (A
, B
, C
)? (all databases are on the same server)
Upvotes: 0
Views: 442
Reputation: 59660
Yes you can. This is a demo query:
select (SELECT count(*) FROM `A`.`tableInA`),
(SELECT count(*) FROM `B`.`tableInB`),
(SELECT count(*) FROM `C`.`tableInC`);
Another demo query:
SELECT * FROM `A`.`tableInA`
where fieldInA in (SELECT fieldInAB FROM `B`.`tableInB`
where fieldInB in (select fieldInBC from `C`.`tableInC`));
Upvotes: 3