How do I combine these 2 queries to produce something like this

QUERY 1
SELECT hotel.country, time.year, time.month, COUNT(booking.room_id) as booked
FROM booking
LEFT JOIN room on room.room_id = booking.room_id
LEFT JOIN hotel on room.hotel_id = hotel.hotel_id
LEFT JOIN time on booking.time_id = time.time_id
GROUP BY hotel.country, time.year, time.month
ORDER by hotel.country, time.year, time.month
QUERY 2
SELECT hotel.country, time.year, time.month, COUNT(checkout.room_id) as checkedout
FROM checkout
LEFT JOIN room on room.room_id = checkout.room_id
LEFT JOIN hotel on room.hotel_id = hotel.hotel_id
LEFT JOIN time on checkout.time_id = time.time_id
GROUP BY hotel.country, time.year, time.month
ORDER BY hotel.country, time.year, time.month
Query:
SELECT T1.country, T1.year, T1.month ,T1.booked,T2.checkedout, (T1.booked T2.checkedout) AS 'Total (booked + checkout)'
FROM ( SELECT hotel.country, time.year, time.month, COUNT(booking.room_id) as booked FROM booking LEFT JOIN room on room.room_id = booking.room_id LEFT JOIN hotel on room.hotel_id = hotel.hotel_id LEFT JOIN time on booking.time_id = time.time_id GROUP BY hotel.country, time.year, time.month ORDER by hotel.country, time.year, time.month ) AS T1 INNER JOIN ( SELECT hotel.country, time.year, time.month, COUNT(checkout.room_id) as checkedout FROM checkout LEFT JOIN room on room.room_id = checkout.room_id LEFT JOIN hotel on room.hotel_id = hotel.hotel_id LEFT JOIN time on checkout.time_id = time.time_id GROUP BY hotel.country, time.year, time.month ORDER BY hotel.country, time.year, time.month )AS T2 ON T1.country=T2.country AND T1.year=T2.year AND T1.month=T2.month
I simply combined both the queries. I created temporary views named T1 and T2 and added a join used that.
Please read the highlighted part which are the main modification of the code.
How do I combine these 2 queries to produce something like this QUERY 1 SELECT hotel.country,...
1. For each query, there are one or more things to do. Some of these queries use SQL constructs we haven't covered in class but that you should be able to figure out the meaning of. a. SELECT C.custid, C.companyname FROM Sales.Customers AS C LEFT OUTER JOIN Sales.Orders as O ON C.custid = O.custid WHERE O.orderid IS NULL Provide the result set generated by this query. One of the result rows should be (22, Customer DTDMN). What does this tell...
How can we assess whether a project is a success or a
failure?
This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...