Fixed most stuff. Need to be very careful before actually deploying the changes
This commit is contained in:
34
sql_analysis.md
Normal file
34
sql_analysis.md
Normal file
@@ -0,0 +1,34 @@
|
||||
```
|
||||
|
||||
select sum(room.total_revenue::float)
|
||||
|
||||
from alpinebits.conversions as con
|
||||
join alpinebits.room_reservations as room on room.conversion_id = con.id
|
||||
join alpinebits.reservations as res on res.id = con.reservation_id
|
||||
|
||||
|
||||
|
||||
where con.reservation_id is not null and room.total_revenue is not null
|
||||
and res.start_date <= room.arrival_date + INTERVAL '7 days'
|
||||
;
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
select res.created_at, con.reservation_date, res.start_date, room.arrival_date,res.end_date,
|
||||
room.departure_date, reservation_type, booking_channel, advertising_medium,
|
||||
guest_first_name,guest_last_name, total_revenue,
|
||||
room.room_status
|
||||
|
||||
from alpinebits.conversions as con
|
||||
join alpinebits.room_reservations as room on room.conversion_id = con.id
|
||||
join alpinebits.reservations as res on res.id = con.reservation_id
|
||||
|
||||
|
||||
|
||||
where con.reservation_id is not null and room.total_revenue is not null
|
||||
and res.start_date <= room.arrival_date + INTERVAL '7 days'
|
||||
order by reservation_date;
|
||||
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user