Reputation: 17397
I want to run select query on multiple table and combine result. for example i want to merge Last_month server availability report with current_month availability report. I have two table Last_table1 and current_table1
Last_table1
===========
Hosts Availability
Server1 99.99%
Server2 87.55%
Current_table1
==============
Hosts Availability
Server1 78.00%
Server2 100.00%
I want to merge both table and need result like following. How do i write select query?
Hosts Last current
Server1 99.99% 78.00%
Server2 87.55% 100.00%
Upvotes: 1
Views: 244
Reputation: 125620
You need to do a JOIN
, and display the proper columns in the proper places:
SELECT
L.Hosts, L.Availability AS Last, C.Availability AS Current
FROM
Last_Table1 L
INNER JOIN
Current_Table1 C
ON
C.Hosts = L.Hosts
Upvotes: 1