I have a database that stores class information. Each class has a different number of sessions, some 1 and some 5.
I need to run a query that shows if all the sessions for a course have been completed, but only if one of the courses falls within the defined time frame.
My (simplified) table structures look like this:
Class Table
UKey Code Year
1 abcd 2005
2 abcd 2005
3 abcd 2005
4 abcd 2004
5 abcd 2004
6 xyz 2005
7 xyz 2005
Status Table
Ukey Status EmployeeID StatusDate
1 C pb001 10/12/2005
2 C pb001 11/15/2005
3 C pb001 6/09/2006
2 C js003 1/34/2005
3 C js003 6/10/2006
If I am looking for completions within the past 30 days, with all statuses of 'C' (no nulls or other values)
I desire to see this:
Ukey Status EmployeeID StatusDate
1 C pb001 10/12/2005
2 C pb001 11/15/2005
3 C pb001 6/09/2006
Note that I need all corresponding records (same course code and year) for that person to be returned, even though only one occured within my window.
Also Note, that I did not return js003 records as she was missing one class.
There is a corresponding employee data table that holds typicall information that can be joined to.
I appreciate everyones help.
Thanks,
Patrick
I need to run a query that shows if all the sessions for a course have been completed, but only if one of the courses falls within the defined time frame.
My (simplified) table structures look like this:
Class Table
UKey Code Year
1 abcd 2005
2 abcd 2005
3 abcd 2005
4 abcd 2004
5 abcd 2004
6 xyz 2005
7 xyz 2005
Status Table
Ukey Status EmployeeID StatusDate
1 C pb001 10/12/2005
2 C pb001 11/15/2005
3 C pb001 6/09/2006
2 C js003 1/34/2005
3 C js003 6/10/2006
If I am looking for completions within the past 30 days, with all statuses of 'C' (no nulls or other values)
I desire to see this:
Ukey Status EmployeeID StatusDate
1 C pb001 10/12/2005
2 C pb001 11/15/2005
3 C pb001 6/09/2006
Note that I need all corresponding records (same course code and year) for that person to be returned, even though only one occured within my window.
Also Note, that I did not return js003 records as she was missing one class.
There is a corresponding employee data table that holds typicall information that can be joined to.
I appreciate everyones help.
Thanks,
Patrick