I have 2 databases namely db1,db2. I need a query that fetch the data from these dbs(db1,db2) which have inturn 2 tables(concessions,invoicing) each.
In db1.concessions
If the databases are on the same SQL Server instance you can use 3 part naming:
database_name.schema_name.object_name
Using Identifiers As Object Names
If the databases are not on the same instance, create a linked server: Linked Servers
Creating Linked Servers (SQL Server Database Engine)
A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources. After a linked server is created, distributed queries can be run against this server, and queries can join tables from more than one data source. If the linked server is defined as an instance of SQL Server, remote stored procedures can be executed.