This is an extension of my previous question . I have a query of inner joining 3 tables. (Actually self joining of the same table).
SELECT r1.HOTEL_ID,
r1.MAX_ADULTS, r1.NO_OF_ROOMS,
r2.MAX_ADULTS, r2.NO_OF_ROOMS,
r3.MAX_ADULTS, r3.NO_OF_ROOMS,
FROM rooms AS r1
INNER JOIN rooms AS r2 ON r1.HOTEL_ID=r2.HOTEL_ID
INNER JOIN rooms AS r3 ON r1.HOTEL_ID=r3.HOTEL_ID
WHERE
r1.MAX_ADULTS=1
AND r2.MAX_ADULTS=2
AND r3.MAX_ADULTS=3
Now I don't want to join them all at every time. I want to join these 3 tables according to a input request by ignoring one or two joins at a time. Can it be done by changing this query itself. (If possible it's better)
Or I have to do it by applying the logic in the code.
您需要修改脚本的条件基础。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.