June 5, 2003 at 10:12 am
I'm running a VB front end with SQL Server database. Im currently converting from an Access database. I need to find an average lead time for items purchased. this would be avg(dteReceived-dteOrdered) but I do not know how to run a date conversion. any suggestions would be appreciated.
"The grass is always greener over the septic tank." ~Leaf
June 5, 2003 at 11:10 am
Use DATEDIFF ( datepart , startdate , enddate ) funcation.
USE pubs
GO
SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
FROM titles
GO
June 5, 2003 at 11:45 am
GREAT! it works
final code:
Avg(DATEDIFF(day,[dteprinted],[dtereceived])) AS AvgLead
"The grass is always greener over the septic tank." ~Leaf
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply