View Full Version : help to construct a query


liangtp
03-25-2009, 09:51 PM
tableA
TicketNo, Remark, Service, ServingTime, TotalTime
5001, N, 5, 12:00:22, 12:00:38
5001, F, 11, 12:02:02, 12:02:21
5002, N, 5, 12:00:44, 12:01:12
5002, F, 11, 12:01:33, 12:01:54

Guys. I have tableA with 4 records.
I wish to write a query that adds the ServingTime of the record with Remark = N to the TotalTime field of the record with Remark = F. Both must be of the same TicketNo. My output would be:

TicketNo, SumOfTime
5001, 12:02:43
5002, 12:02:38

Could you please help me to construct the query? Thanks.

khawar
03-25-2009, 10:46 PM
Download the attached file and check query "yourquery"

Hope it fulfills your requirement

HiTechCoach
03-25-2009, 10:48 PM
Welcome to AWF!

I am not sure how to do it without some VBE code.

See:
Functions for calculating and for displaying Date/Time values in Access (http://support.microsoft.com/default.aspx?scid=kb;EN-US;210604)
*** Scroll down to GetTimeCardTotal() sample function