Postgresql 9.1 を使用してデータベースを作成しています 与えられたテーブル:
CREATE TABLE rooms(
room_number int,
property_id int,
type character varying,
PRIMARY KEY (room_number, property_id)
);
Insert into rooms values (1,1,double),(2,1,double),(3,1,triple)
CREATE TABLE reservations(
reservation_ID int,
property_id int,
arrival date,
departure date,
room_num int,
PRIMARY KEY(reservation_ID,property_id)
FOREIGN KEY (room_number, property_id)
);
INSERT INTO orders VALUES (1,1,2013-9-27,2013-9-30,1),
(2,1,2013-9-27,2013-9-28,2),
(3,1,2013-9-29,2013-9-30,3);
2 つの日付を指定し、その間に空き状況を確認したいのですが。したがって、最初の列に次のように表示されます。
指定された ~ の間のすべての日付
空室状況を表示する部屋のタイプごとに 1 つの列が追加されます。
したがって、入力として 2013-9-27 と 2013-9-30 を指定すると、私の結果は次のようになります。