Toy Company Third Query

PHOTO EMBED

Sat Dec 28 2024 21:04:29 GMT+0000 (Coordinated Universal Time)

Saved by @wsutanto #mysql

SELECT temp.customerNumber, c.country, c.city, AVG(temp.timeShipped) AS avgTimeShipped
FROM (
	SELECT customerNumber, shippedDate - orderDate AS timeShipped
	FROM orders
) AS temp
JOIN customers c ON temp.customerNumber = c.customerNumber
GROUP BY c.customerNumber
ORDER BY c.country, avgTimeShipped DESC;
content_copyCOPY