I am trying to create this query as part of an Access app.
I am familiar with SQL but I am stumped by this query.
I have two tables:
tbl_Member
MemberID (pk) autonumber
Lname (text)
WatchOffGroup (text)
Example Data
MemberID Lname WatchOffGroup
1 Smith 1
2 Jones 2
3 Green 3
*******************************
tbl_Dates
DateID (pk) autonumber
Date (date/time)
DOW (text)
GroupOff (text) there is one record for every WatchOffGroup
that is scheduled OFF WORK on each date in tbl_Date.
Example Data
DateID Date DOW GroupOff
1 11/4/05 Fri 1
2 11/5/05 Sat 1
3 11/5/05 Sat 2
4 11/6/05 Sun 1
5 11/6/05 Sun 2
6 11/7/05 Mon 2
7 11/7/05 Mon 3
8 11/8/05 Tues 3
9 11/8/05 Tues 1
****************************************************
On Fri 11/4/05 Smith (WatchOffGroup 1) is off work and both
Jones (WatchOffGroup 2) and Green (WatchOffGroup 3) are
working. Neither Jones nor Green's Watch Off Group is
listed in the tbl_Dates for 11/4/05.
tbl_Member has basic employee info: last name and the
Watch Off Group they belong to. The members work a
rotating schedule - having different days off each week.
tbl_Dates has the date info: the calendar date
(ex. 11/5/05), the Date of Week (Sat) and a record for
each Watch Off Group that is scheduled not to work on
that day.
I want a query that will produce a list of member's
names who are NOT OFF on the selected date
(the ones that ARE working - their Watch Off Groups
are NOT listed in the tbl_Dates).
So, (in English) I want to
select Last name from the Member's table
when that member's Watch Off Group is NOT
listed in the Dates table
on the date I choose.
I already have the tbl_Dates that holds the Watch Off
data. I know how to add the date parameter and
I don't want to have to create a second Watch ON table -
in the real table there would be 14 Watch ON Groups for each
day of the year - and records would have to be created
for the next few years.
I am familiar with SQL but I am stumped by this query.
I have two tables:
tbl_Member
MemberID (pk) autonumber
Lname (text)
WatchOffGroup (text)
Example Data
MemberID Lname WatchOffGroup
1 Smith 1
2 Jones 2
3 Green 3
*******************************
tbl_Dates
DateID (pk) autonumber
Date (date/time)
DOW (text)
GroupOff (text) there is one record for every WatchOffGroup
that is scheduled OFF WORK on each date in tbl_Date.
Example Data
DateID Date DOW GroupOff
1 11/4/05 Fri 1
2 11/5/05 Sat 1
3 11/5/05 Sat 2
4 11/6/05 Sun 1
5 11/6/05 Sun 2
6 11/7/05 Mon 2
7 11/7/05 Mon 3
8 11/8/05 Tues 3
9 11/8/05 Tues 1
****************************************************
On Fri 11/4/05 Smith (WatchOffGroup 1) is off work and both
Jones (WatchOffGroup 2) and Green (WatchOffGroup 3) are
working. Neither Jones nor Green's Watch Off Group is
listed in the tbl_Dates for 11/4/05.
tbl_Member has basic employee info: last name and the
Watch Off Group they belong to. The members work a
rotating schedule - having different days off each week.
tbl_Dates has the date info: the calendar date
(ex. 11/5/05), the Date of Week (Sat) and a record for
each Watch Off Group that is scheduled not to work on
that day.
I want a query that will produce a list of member's
names who are NOT OFF on the selected date
(the ones that ARE working - their Watch Off Groups
are NOT listed in the tbl_Dates).
So, (in English) I want to
select Last name from the Member's table
when that member's Watch Off Group is NOT
listed in the Dates table
on the date I choose.
I already have the tbl_Dates that holds the Watch Off
data. I know how to add the date parameter and
I don't want to have to create a second Watch ON table -
in the real table there would be 14 Watch ON Groups for each
day of the year - and records would have to be created
for the next few years.