How To Merge These Queries Into 1 Using Subquery
Select * from HotelPerson Where RoomID IN (select ID from HotelRoom Where BookingID = 36 ) Select * from HotelCancelationPolicy Where RoomID IN (select ID from HotelRoom Whe
Solution 1:
This will give you all the columns from both tables in one table.
SELECT*FROM HotelPerson A, HotelCancelationPolicy B
WHERE A.RoomID = B.RoomID
AND A.RoomID IN (SELECT ID FROM HotelRoom WHERE BookingID =36)
Solution 2:
Use UNION to Get Distinct elements or UNION ALL for all rows from both tables
Select*from HotelPerson
Where RoomID IN (select ID from HotelRoom Where BookingID =36 )
UNIONALLSelect*from HotelCancelationPolicy
Where RoomID IN (select ID from HotelRoom Where BookingID =36 )
Post a Comment for "How To Merge These Queries Into 1 Using Subquery"