Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUM DateDiff

Status
Not open for further replies.

ghddte

Technical User
Oct 16, 2008
1
GB
Hi all...
Im trying to sum the results from a DATEDIFF query.
The query runs on a web page on our intranet and uses .ASP to connect to our MS Access database.

Endate1 and Endate2 are Request.Form varibales sent to the query.

-------------------------

The Query:
SELECT ExpedsLocal.StartReq, ExpedsLocal.EndReq,SUM( DateDiff('d',[StartReq],[EndReq]) AS Daysail)
FROM ExpedsLocal
WHERE StartReq BETWEEN #enddate1# AND #enddate2#

----------------------------

Basically I have a list of Local Expeditions [tbl.ExpedsLocal]

and want to SUM all the days the Expeds have run. I am trying to find the number of days via the DATEDIFF. 'StartReq' is the the Date Field of the start date and the 'EndReq' is the end of the exped. I want to find the difference between these 2 dates and then total the date differences up..

Some help would be fantastic

Thanks from a beginneer
:)
 
Something like this ?
strSQL = "SELECT SUM(EndReq-StartReq) AS Daysail FROM ExpedsLocal WHERE StartReq BETWEEN #" & enddate1 & "# AND #" & enddate2 & "#"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top