Link to home
Start Free TrialLog in
Avatar of ntgOne
ntgOne

asked on

SQL Development

Hello -
I am not all a SQL expert but have to create a query which displays data from 2 different databases.

Please see attached image -

I have Database A  Table 1 which lists my applications and their job execution status
I have Database B Table 1 which lists my application availability status
As shown in attachment I need to join each database and table in question for 1 report which shows both application availability along with each applications total failed job count along with availability for past day as opposed to every hour of the day.

The only way I am able to relate both tables is via part of the application name being in the the job_name column of Database A and AppName column of Database B.  For example "App1"  

I have no idea if / how it is possible to join 2 databases where as in this case the common application name not represented the same way in each database.User generated image
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

You can just use 3-part naming and join the tables like you would tables in the same database.

SELECT ...
FROM DatabaseA.dbo.Table1 AS AT1
INNER JOIN DatabaseB.dbo.Table1 AS BT1
   ON ...
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ntgOne
ntgOne

ASKER

Thank you Paul  - this is outstanding.  I will give it a try this weekend / monday.

Regards
Rich
ntgOne, do you still need help on this question?