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;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter