From 53d80f12df73568cd26de28f4f13e4661f247b4d Mon Sep 17 00:00:00 2001
From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com>
Date: Tue, 21 May 2024 08:39:26 +0000
Subject: Tue, May 21, 2024, 1:39 AM -07:00

---
 wk7/pset/fiftyville/log.sql | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'wk7/pset/fiftyville/log.sql')

diff --git a/wk7/pset/fiftyville/log.sql b/wk7/pset/fiftyville/log.sql
index 0ff4b83..0e7a840 100644
--- a/wk7/pset/fiftyville/log.sql
+++ b/wk7/pset/fiftyville/log.sql
@@ -201,10 +201,29 @@ WHERE phone_number IN (
 
 SELECT name
 FROM people
-JOIN phone ON people.phone_number = phone.phone_number
+JOIN phone ON people.phone_number = phone_calls.phone_number
 JOIN passengers ON people.passport_number = passengers.passport_number
 JOIN bakery_security_logs ON people.license_plate = bakery_security_logs.license_plate
-WHERE
+WHERE year = 2023
+AND month = 7
+AND day = 28
+AND duration <= 60
+AND flight_id = (
+    SELECT destination_airport_id
+    FROM flights
+    WHERE year = 2023
+    AND month = 7
+    AND day = 29
+    AND origin_airport_id = (
+        SELECT id
+        FROM airports
+        WHERE city = "Fiftyville"
+    )
+    ORDER BY hour
+    LIMIT 1
+) AND activity LIKE "exit"
+;
+
 
 
 SELECT name
-- 
cgit v1.2.3

