How can I query a table from one database and another table from another database, in sql server
that is, I need to consult the company of the 2 databases
I was doing it this way but it gives me an error
The databases are: Sk_BDDespachos
and Sk_BDDespachosPruebas
The tables are: Sk_Empresa
and Sk_Empresa
the field of the tables are: Sk_Nombre_Empresa
andSk_Nombre_Empresa
SELECT
Sk_BDDespachos.Sk_Empresa.Sk_Nombre_Empresa,
Sk_BDDespachosPruebas.Sk_Empresa.Sk_Nombre_Empresa
FROM Sk_BDDespachos.Sk_Empresa , Sk_BDDespachosPruebas.Sk_Empresa;
You can try it this way
Try this
If what you need is to consult the companies of both tables, you could do something like this:
Since an inner join would show you only the companies that match and a query like the one you were doing will show you the companies from both tables that are related to each other. I don't really know what you expect from your query.