dynamictiger
Registered User.
- Local time
- Today, 08:28
- Joined
- Feb 3, 2002
- Messages
- 270
I have the following query.
SELECT qryServFindNextAvailableTime.JobDate, qryServFindNextAvailableTime.ServPerson, First(qryServAllStartFinish.Start) AS FirstOfStart, qryServFindNextAvailableTime.TimePromised, CSng(DateDiff("n",[Start],[TimePromised])) AS AvailableMinutes, [AvailableMinutes]/60 AS Expr1
FROM qryServFindNextAvailableTime INNER JOIN qryServAllStartFinish ON qryServFindNextAvailableTime.ServPerson = qryServAllStartFinish.ServicePersonID
GROUP BY qryServFindNextAvailableTime.JobDate, qryServFindNextAvailableTime.ServPerson, qryServFindNextAvailableTime.TimePromised, CSng(DateDiff("n",[Start],[TimePromised])), [AvailableMinutes]/60
WITH OWNERACCESS OPTION;
I am trying to get the gap between the first booked time and the start time. For example if the first booked job is at 12.40 pm and the employee starts at 8.00 am there are 4.666666666 hours available. The object being that if another job books in then we know if it is 3.5 hours there is enough time to do it before the 12.40 job.
This sort of works but it is returning all the jobs for the day. I only want to return one job, being the first of the day. I know I can get there with another query I am just trying to avoid another query if I can as I have so many queries in this application it is getting out of hand - not to say my imagination for unique names is limited.
SELECT qryServFindNextAvailableTime.JobDate, qryServFindNextAvailableTime.ServPerson, First(qryServAllStartFinish.Start) AS FirstOfStart, qryServFindNextAvailableTime.TimePromised, CSng(DateDiff("n",[Start],[TimePromised])) AS AvailableMinutes, [AvailableMinutes]/60 AS Expr1
FROM qryServFindNextAvailableTime INNER JOIN qryServAllStartFinish ON qryServFindNextAvailableTime.ServPerson = qryServAllStartFinish.ServicePersonID
GROUP BY qryServFindNextAvailableTime.JobDate, qryServFindNextAvailableTime.ServPerson, qryServFindNextAvailableTime.TimePromised, CSng(DateDiff("n",[Start],[TimePromised])), [AvailableMinutes]/60
WITH OWNERACCESS OPTION;
I am trying to get the gap between the first booked time and the start time. For example if the first booked job is at 12.40 pm and the employee starts at 8.00 am there are 4.666666666 hours available. The object being that if another job books in then we know if it is 3.5 hours there is enough time to do it before the 12.40 job.
This sort of works but it is returning all the jobs for the day. I only want to return one job, being the first of the day. I know I can get there with another query I am just trying to avoid another query if I can as I have so many queries in this application it is getting out of hand - not to say my imagination for unique names is limited.