Help! Im stuck trying to produce a query which needs to use sub queries. This is an area where I always seem to struggle! Basically, im trying to produce a query that will display for a learner, the course code, the course start date, and register information related to that course. The difficulty im having is that registers are not always linked to the course code, some registers are linked to a code which may have more than one course code above it…..
The data is held in the following areas,
Course_Learner
Learner_ID – Example Data - 120120
Course_code – Example Data – ABC1
Registers
Register_ID, - Example Data – R123
Reg_Course_Code – A1
Reg_Date – 03/09/2007
Learner_ID - 120120
Course_Details
Course_code, Example Data = ABC1
Child_course_code Example Data = A1
The format I would like to produce is the following….
Learner_ID, Example Data - 120120
Course_Code, - Example Data ABC1
Course_Start_Date, - Example Data – 01/09/2007
Count (Register_ID) – 7
Min (Register_Date) – 02/09/2007
The problem im having is that I only want to count registers for a learner if the register course code is either a child or parent course code. For example, course code ABC1 may have 3 child codes underneath it, A1,A2 and A3. The registers for course code ABC1 may be assigned to any of the four possible codes. Within the Registers table a leaner may have a number of registers that they appear on but I only want to count the ones that are part of the course from course_learner. What would be the easiest way of achieving this?
The data is held in the following areas,
Course_Learner
Learner_ID – Example Data - 120120
Course_code – Example Data – ABC1
Registers
Register_ID, - Example Data – R123
Reg_Course_Code – A1
Reg_Date – 03/09/2007
Learner_ID - 120120
Course_Details
Course_code, Example Data = ABC1
Child_course_code Example Data = A1
The format I would like to produce is the following….
Learner_ID, Example Data - 120120
Course_Code, - Example Data ABC1
Course_Start_Date, - Example Data – 01/09/2007
Count (Register_ID) – 7
Min (Register_Date) – 02/09/2007
The problem im having is that I only want to count registers for a learner if the register course code is either a child or parent course code. For example, course code ABC1 may have 3 child codes underneath it, A1,A2 and A3. The registers for course code ABC1 may be assigned to any of the four possible codes. Within the Registers table a leaner may have a number of registers that they appear on but I only want to count the ones that are part of the course from course_learner. What would be the easiest way of achieving this?