Hard
INNER JOIN
Pro Challenge
Latest Valid Address at Order Time
For every order, select the customer's address version valid at ordered_at. Validity is inclusive at valid_from and exclusive at valid_to; NULL valid_to is open-ended. If versions share valid_from, choose the highest address_id. Return order_id, address_id and city. Return columns: order_id, address_id, city.
Preparing the interactive SQL workspace...