本文介绍了如何使用子查询将这些查询合并为 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Select * from HotelPerson
 Where RoomID IN (select ID from HotelRoom Where BookingID = 36 )

 Select * from HotelCancelationPolicy
 Where RoomID IN (select ID from HotelRoom Where BookingID = 36 )

如何将这两个查询合并为 1 个查询?

How can I merge these both queries into 1 query ?

推荐答案

这会将两个表中的所有列都显示在一个表中.

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)

这篇关于如何使用子查询将这些查询合并为 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 05:57