Re: Challenging queries query...
- From: John Spencer <spencer4@xxxxxxxxxxx>
- Date: Thu, 29 Jun 2006 09:27:39 -0400
You can do this is two queries.
--First query gets everyone that has a record for the date (save query)
--Second query is an unmatched query that uses the first query and the employees table.
Or you can try the following query
SELECT E.EmpID
FROM Employees as E
LEFT JOIN
(SELECT W.EmpID
FROM WorkHours as W
WHERE W.WorkDate = CDate([Insert Date])) as W2
On E.EmpID = W2.EmpID
WHERE W2.EmpId is Null
scubadiver wrote:
.
Sorry,
I re-read my message and it had a complete lack of clarity.
The two tables have a 1-to-many relationship so each employeeID has many
weekIDs.
My logic tells me that it isn't possible to list the employees who have a
certain date missing.
"Jerry Whittle" wrote:
PARAMETERS [Enter Date] DateTime;
SELECT Employees.EMPID, Employees.HireDate
FROM Employees
WHERE (((Employees.EMPID) Not In (SELECT Employees.EMPID
FROM Employees
WHERE Employees.HireDate=[Enter Date])));
Something like the above will work IF (1) your date field is a date/time
datatype and (2) it only includes the Date portion and no time (except
midnight). It will take a little more work if you have something like
6/28/2006 11:30AM stored.
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"scubadiver" wrote:
Or not as the case may be.
My db holds on-going weekly working hours records for each employee.
I would like to set up a query that will tell me which employees are missing
a particular date (the unmatched query only seems to list those employees
that have NO corresponding weekly records at all).
cheers
- Prev by Date: Re: Not getting the correct record from query -- create Unique Ind
- Next by Date: Re: Query: Two Dates in one cell of a field. Need criteria help
- Previous by thread: Re: Challenging queries query...
- Next by thread: Summing query?
- Index(es):
Relevant Pages
|
|