Re: SQL to combine required and completed training courses.




rkc wrote:
Considering the following tables is it possible to
write an SQL query that would result in rows that look like
(EmpID, CourseID, DateTaken) for each employee and each
required course in one result set?

1 4 8/12/2005
1 5 8/12/2005
1 6 NULL
2 6 7/7/2006
2 4 NULL

Employees(EmpID*, PosID)
Positions(PosID*)
Courses(CourseID*)
RequiredCourses(CourseID*, PosID*)
CompletedCourses(EmpID*, CourseID*, DateTaken*)


Just thinking out loud...

what does this give you?

SELECT cc.EmpID,cc.CourseID,cc.DateTaken
FROM CompletedCourses cc, Employees e, RequiredCourses rc
WHERE cc.EmpID = e.EmpID
AND cc.CourseID = rc.CourseID
AND rc.PosID = e.PosID
ORDER BY cc.EmpID,cc.DateTaken;

.



Relevant Pages

  • Re: Still Struggling...
    ... means "Find the first record in the RecordsetClone in which EmpID is the ... Each employee can only have 1 classification (Admin., ... tblClassifications 1:M tblEmployees, ... tblTitles M:M tblTitlesEmps ...
    (microsoft.public.access.gettingstarted)
  • Re: Extract Outlook Address book properties into Excel
    ... Michael Bauer - MVP Outlook ... I think since the Employee names & Emp Code belongs to a Global Address ... Custom-defined type like EmpID. ... Dim xl as Excel.Application ...
    (microsoft.public.outlook.program_vba)
  • Re: Still Struggling...
    ... Since each table is only allowed one record per employee, ... EmpID will be a unique value for each record in both tables. ... TitlesEmpsID Autonumber ... be a record in tblEmpClassifications to reflect that fact. ...
    (microsoft.public.access.gettingstarted)
  • Re: Template or HELP wRelationships
    ... "John W. Vinson" wrote: ... reports to (another EmpID), ... ... TRANSACTIONS: Event Date, New Salary, Reason for Change (for tracking new ... the transactions table clearly pertains to an employee... ...
    (microsoft.public.access.gettingstarted)
  • Re: Left Outer Join not returning expected Null records
    ... for each month); Labor, which ... > lname, fname, and all the other information about each employee. ...
    (microsoft.public.sqlserver.programming)