summaryrefslogtreecommitdiff
path: root/graphs/sql/battle_plan/req03.sql
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:08:27 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:08:27 +0200
commitc9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (patch)
tree3e4f42f93c7ae89a364e4d51fff6e5cec4e55fa9 /graphs/sql/battle_plan/req03.sql
add: graphs et rushs
Diffstat (limited to 'graphs/sql/battle_plan/req03.sql')
-rw-r--r--graphs/sql/battle_plan/req03.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/graphs/sql/battle_plan/req03.sql b/graphs/sql/battle_plan/req03.sql
new file mode 100644
index 0000000..5a3ba51
--- /dev/null
+++ b/graphs/sql/battle_plan/req03.sql
@@ -0,0 +1,17 @@
+SELECT
+ people.first_name,
+ people.last_name,
+ gusto_tables.number_of_seats AS guest_number,
+ round(reservations.bill_total::numeric, 2) AS bill_total
+FROM gusto_reservations AS reservations,
+ gusto_tables,
+ gusto_guests AS guests,
+ people
+WHERE reservations.table_id = gusto_tables.id
+ AND reservations.id = guests.reservation_id
+ AND reservations.cancelled = FALSE
+ AND guests.guest_id = people.id
+ AND people.last_name LIKE concat(reservations.reservation_name, '%')
+ORDER BY
+ gusto_tables.number_of_seats ASC, reservations.bill_total DESC NULLS LAST
+LIMIT 10;