How do I get a result across 2 tables

后端 未结 2 1712
自闭症患者
自闭症患者 2021-01-29 16:31

I have 2 tables. One is called booking and another one is called room. The columns in booking are: RoomID, startdate, enddate, customerId. The columns in room is: RoomID, size.<

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-29 17:18

    Use a basic INNER JOIN to achieve that.

    SELECT b.*
    FROM booking b INNER JOIN room r USING(RoomID)
    WHERE @date_input BETWEEN startdate AND enddate AND size = @size_input;
    

    Change @date_input and @size_input to your real input.

提交回复
热议问题