G
Gary Nelson
In Access2000 (frontend) SQL (backend) - I have a report which has two
fields - StartTime and EndTime. I have calculated the difference to receive
a sum of the amount of time spent on each individual task. I am now looking
to calculate the total time of all tasks listed. For example:
JOB NUMBER
557801
START TIME
12:30PM
END TIME
1:00PM
TIME SPENT
30 MINS
------------------------------
JOB NUMBER
557802
START TIME
12:00PM
END TIME
1:00PM
TIME SPENT
60 MINS
I want to provide a total of TimeSpent of all jobs - which in the above
examples would be equal to 1 hr 30 mins. The question is - HOW???
Please see my stored procedure below - or can this be done on my report?
----------------------------------------------------------------------------
----------
Alter Procedure spSUNYCorrections As
SELECT BookAll.JobNum, BookAll.Author, BookAll.Title,
BookAll.PublisherID, BookAll.DateIn,
[Cover Prepress Detail Entry].StatusID,
[Cover Prepress Detail Entry].Start,
[Cover Prepress Detail Entry].[End],
[Cover Prepress Detail Entry].Comments,
[Cover Prepress Detail Entry].CorrBillable,
[Scheduling - AD].dtSendToBndry, [Scheduling - AD].dtBound,
[Scheduling - AD].dtShipped, BookAll.PrintCode, DateDiff(mi,[Cover
Prepress Detail Entry].[Start],[Cover Prepress Detail Entry].[End]) AS
MinuteDiff
FROM dbo.BookAll LEFT OUTER JOIN
dbo.[Scheduling - AD] ON
dbo.BookAll.JobNum = dbo.[Scheduling - AD].JobNum LEFT OUTER
JOIN
dbo.[Cover Prepress Detail Entry] ON
dbo.BookAll.JobNum = dbo.[Cover Prepress Detail Entry].JobNum
WHERE (dbo.BookAll.DateIn > CONVERT(DATETIME,
'2003-01-01 00:00:00', 102)) AND
(dbo.[Cover Prepress Detail Entry].CorrBillable = 1) AND
(dbo.[Cover Prepress Detail Entry].StatusID = 2 OR
dbo.[Cover Prepress Detail Entry].StatusID = 33 OR
dbo.[Cover Prepress Detail Entry].StatusID = 22) AND
(dbo.BookAll.PrintCode = N'10')
fields - StartTime and EndTime. I have calculated the difference to receive
a sum of the amount of time spent on each individual task. I am now looking
to calculate the total time of all tasks listed. For example:
JOB NUMBER
557801
START TIME
12:30PM
END TIME
1:00PM
TIME SPENT
30 MINS
------------------------------
JOB NUMBER
557802
START TIME
12:00PM
END TIME
1:00PM
TIME SPENT
60 MINS
I want to provide a total of TimeSpent of all jobs - which in the above
examples would be equal to 1 hr 30 mins. The question is - HOW???
Please see my stored procedure below - or can this be done on my report?
----------------------------------------------------------------------------
----------
Alter Procedure spSUNYCorrections As
SELECT BookAll.JobNum, BookAll.Author, BookAll.Title,
BookAll.PublisherID, BookAll.DateIn,
[Cover Prepress Detail Entry].StatusID,
[Cover Prepress Detail Entry].Start,
[Cover Prepress Detail Entry].[End],
[Cover Prepress Detail Entry].Comments,
[Cover Prepress Detail Entry].CorrBillable,
[Scheduling - AD].dtSendToBndry, [Scheduling - AD].dtBound,
[Scheduling - AD].dtShipped, BookAll.PrintCode, DateDiff(mi,[Cover
Prepress Detail Entry].[Start],[Cover Prepress Detail Entry].[End]) AS
MinuteDiff
FROM dbo.BookAll LEFT OUTER JOIN
dbo.[Scheduling - AD] ON
dbo.BookAll.JobNum = dbo.[Scheduling - AD].JobNum LEFT OUTER
JOIN
dbo.[Cover Prepress Detail Entry] ON
dbo.BookAll.JobNum = dbo.[Cover Prepress Detail Entry].JobNum
WHERE (dbo.BookAll.DateIn > CONVERT(DATETIME,
'2003-01-01 00:00:00', 102)) AND
(dbo.[Cover Prepress Detail Entry].CorrBillable = 1) AND
(dbo.[Cover Prepress Detail Entry].StatusID = 2 OR
dbo.[Cover Prepress Detail Entry].StatusID = 33 OR
dbo.[Cover Prepress Detail Entry].StatusID = 22) AND
(dbo.BookAll.PrintCode = N'10')