Skip to content

Instantly share code, notes, and snippets.

@nedgrady
Created November 28, 2021 22:04
Show Gist options
  • Save nedgrady/34c01372313608e62d98029b7c9eb933 to your computer and use it in GitHub Desktop.
Save nedgrady/34c01372313608e62d98029b7c9eb933 to your computer and use it in GitHub Desktop.
SELECT UnfulfilledReservation.Id,
PotentialGuest.Name,
UnfulfilledReservation.Start,
UnfulfilledReservation.Finish
FROM ReservationRequest UnfulfilledReservation
INNER JOIN Customer PotentialGuest ON PotentialGuest.CustomerId = UnfulfilledReservation.CustomerId
LEFT JOIN Booking ON Booking.CustomerId = PotentialGuest.CustomerId
WHERE UnfulfilledReservation.Start < GETDATE()
AND Booking.BookingId IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment