I keep getting error code 1248 every derived table must have its own alias on the following and cannot figure out why. I have tried rewriting several times to see if I can catch where I am making a mistake but I guess I am overlooking something.
SELECT order_id, order_date, c.customer_id, last_name
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id,
(
SELECT phone
FROM addresses a
JOIN orders od ON a.customer_id = od.customer_id
)
WHERE address_id = billing_address_id AND ship_date IS NULL;