Could someone please help me? I need to find this query, but I cannot get them to display as one. I know I wrote it wrong but not sure how to correct it. I need it to only display the customer who booked the longest period.
SELECT CUSTOMERS.CUSTOMER_ID, CUSTOMERS.CUSTOMER_NAME,
ACCOMMODATION_BOOKINGS.CHECKIN_DATE, ACCOMMODATION_BOOKINGS.NIGHTS
FROM CUSTOMERS, ACCOMMODATION_BOOKINGS
WHERE CUSTOMERS.CUSTOMER_ID = ACCOMMODATION_BOOKINGS.CUSTOMER_ID
SELECT MAX(Nights) AS NIGHTS
FROM ACCOMMODATION_BOOKINGS, CUSTOMERS;
This will give you the desired result: