I have 2 databases, a master and a company. Both databases are on the same server currently but will eventually be on different servers. Is it possible to perform a query that joins tables across databases in dapper? My application is Asp.NET Core and the databases are MariaDB (so basically MySQL).
Here is an example of a query I'm trying to perform:
select a.username, b.name from company.user a join master.lookup_user_type b on a.user_type_id = b.id
Maybe I'm confused what my actual question is, maybe I just need to figure out how to have one conncetion string that references multiple databases.
Yes, it is possible to perform a query across two different databases on the same server, as long as the user you're logging in as has permission to access both databases.. Assuming your databases are named
master, then your query looks correct.
If your databases are on two different servers, you will need to use federated tables.