Hi.
So I have a db where I collect reservations for a few properties and I need to find a way to test if a new reservation overlaps an existing one.
In short, I have this table above in a db and what I need to do is to run a query (I imagine) that checks all reservations at each specific property, then checks which reservations are "Active" and then compares them with each other to find if they overlap.
Quick thing though: Reservations for any unique property can start and end on the same day, such as reservations 8 and 9, with "Son Bota". It is only when the dates really go past each other, such as with reservations 15 and 16 on property "Alconasser Dream" or 30 and 33 in "Torreta" that it is considered an overlap.
What do I need to do to, 1) Get a warning when a new reservation is entered shich overlaps an existing one, and 2) A list of any overlapping reservations after pressing a button?
Thanks in advance!
mafhobb
So I have a db where I collect reservations for a few properties and I need to find a way to test if a new reservation overlaps an existing one.
ID | PropertyName | GuestName | CheckInDate | CheckOutDate | ReservationSource | CleaningAfter | Status |
1 | Son Bota | Owners | 03-03-21 | 07-03-21 | 5 | No | Active |
7 | Son Bota | Eve | 30-05-22 | 17-06-22 | 2 | Yes | Cancelled |
8 | Son Bota | Frank | 17-06-21 | 24-06-21 | 1 | Yes | Active |
9 | Son Bota | Owners | 24-06-21 | 24-07-21 | 5 | Yes | Active |
10 | Son Bota | Mark | 24-07-21 | 07-08-21 | 2 | Yes | Cancelled |
12 | Portoluz, 72 | Imke | 19-03-21 | 27-03-21 | 2 | Yes | Active |
13 | Portoluz, 72 | Cynthia | 07-05-21 | 15-05-21 | 2 | Yes | Active |
14 | Alconasser Dream | Dolores | 15-03-21 | 22-03-21 | 2 | Yes | Active |
15 | Alconasser Dream | Hans | 01-07-21 | 07-07-21 | 2 | Yes | Active |
16 | Alconasser Dream | Johann | 06-07-21 | 18-07-21 | 2 | Yes | Active |
17 | Alconasser Dream | Nika | 05-08-21 | 11-08-21 | 2 | Yes | Cancelled |
30 | Torreta | Joyce | 18-03-21 | 27-03-21 | 2 | Yes | Active |
32 | Torreta | Carolin | 08-08-21 | 19-08-21 | 2 | Yes | Cancelled |
33 | Torreta | Pauline | 26-03-21 | 04-04-21 | 4 | Yes | Active |
34 | Torreta | Phil | 12-09-21 | 21-09-21 | 4 | Yes | Cancelled |
In short, I have this table above in a db and what I need to do is to run a query (I imagine) that checks all reservations at each specific property, then checks which reservations are "Active" and then compares them with each other to find if they overlap.
Quick thing though: Reservations for any unique property can start and end on the same day, such as reservations 8 and 9, with "Son Bota". It is only when the dates really go past each other, such as with reservations 15 and 16 on property "Alconasser Dream" or 30 and 33 in "Torreta" that it is considered an overlap.
What do I need to do to, 1) Get a warning when a new reservation is entered shich overlaps an existing one, and 2) A list of any overlapping reservations after pressing a button?
Thanks in advance!
mafhobb