0

How would the query below properly return results by days, instead of a traditional time result 'YYYY-MM-DD 00:00:00:000'?

select o.CustomerID, (max(o.OrderDate) - min(o.ShippedDate)) as 'Ship Time'
from Orders o
group by o.CustomerID

As always, appreciate the help!

  • Try `DATEDIFF(MAX(o.OrderDate), MIN(o.ShippedDate))` – Tim Biegeleisen May 15 '17 at 16:18
  • I appreciate the help @TimBiegeleisen, however I'm not getting an answer from the duplicate answer you pointed out. It appears on that post, the question is geared more towards specific dates, where I want to compare the days is took to ship an item from the database, and return the results in the number of days. Is there a way to do this, instead of inserting dates into the query? Thanks again mate! – user7879707 May 15 '17 at 16:42

0 Answers0