While going through some of your data, you see that there are some outliers in shipdate that have badly affected your results. Use the following as the basis for your query but strip off all shipdates less than 0 or greater than 365 days difference from the order date.
Here is the SQL I have written up so far. What am I missing?
SELECT ol.shipdate - o.orderdate as day, COUNT(*) as numol
FROM dw.orders o JOIN dw.orderline ol ON o.orderid = ol.orderid
group by (ol.shipdate - o.orderdate)
ORDER BY 1;
This problem is out of a book that I'm working on by myself.
WHEREcriteria