J
John
I am trying to get some data from two tables.
Tbl_Dates has multiple values in the WatchOffGroup field.
I know that this is not a best practice - but I have inherited this
table.
Given this, I need help with a select query that results in producing
data from these two tables:
tbl_Members
MemberID
Lname
WatchOff
Sample Data
MemberID Lname WatchOffGroup
1 Jones 4
2 Smith 7
3 Green 1
***************
tbl_Dates
DateID
Date
WatchOff
Sample Data
DateID Date WatchOffGroups
1 9/1/05 12
2 9/2/05 23
3 9/3/05 34
4 9/4/05 56
The problem data is in the WatchOffGroups field above.
Group 1 and Group 2 are both in the same Watch Off Group field.
I know it would be better if there were a unique record for each watch
off group for each date but is there a way I can use this data. In the
real DB there are 22 groups: 8 are off each day and 14 are on each day
- that would be 22 records per day x 365 days x 3 years of data I would
have to create. I'm hoping to avoid that.
****************
I want to be able to choose any date and then return the names of the
members who have their watch off group listed in the tbl_Dates.WatchOff
field for the selected date.
Example:
If I choose the date 9/1/05, there are two listed watch off groups for
that date listed in tbl_Dates: group and group 2.
I want to be able to produce a result from a query that lists Member
Green's Last name because he is in Group 1 which is one of the watch
off groups listed for 9/1/05 in the Dates table.
If I choose 9/3/05, I should see Jones in the query result because
Jones is in Watch Off Group 4.
Any suggestions would be appreciated.
Thanks
John
Tbl_Dates has multiple values in the WatchOffGroup field.
I know that this is not a best practice - but I have inherited this
table.
Given this, I need help with a select query that results in producing
data from these two tables:
tbl_Members
MemberID
Lname
WatchOff
Sample Data
MemberID Lname WatchOffGroup
1 Jones 4
2 Smith 7
3 Green 1
***************
tbl_Dates
DateID
Date
WatchOff
Sample Data
DateID Date WatchOffGroups
1 9/1/05 12
2 9/2/05 23
3 9/3/05 34
4 9/4/05 56
The problem data is in the WatchOffGroups field above.
Group 1 and Group 2 are both in the same Watch Off Group field.
I know it would be better if there were a unique record for each watch
off group for each date but is there a way I can use this data. In the
real DB there are 22 groups: 8 are off each day and 14 are on each day
- that would be 22 records per day x 365 days x 3 years of data I would
have to create. I'm hoping to avoid that.
****************
I want to be able to choose any date and then return the names of the
members who have their watch off group listed in the tbl_Dates.WatchOff
field for the selected date.
Example:
If I choose the date 9/1/05, there are two listed watch off groups for
that date listed in tbl_Dates: group and group 2.
I want to be able to produce a result from a query that lists Member
Green's Last name because he is in Group 1 which is one of the watch
off groups listed for 9/1/05 in the Dates table.
If I choose 9/3/05, I should see Jones in the query result because
Jones is in Watch Off Group 4.
Any suggestions would be appreciated.
Thanks
John