Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Annoying SQL Query
Message
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Annoying SQL Query
Miscellaneous
Thread ID:
00435486
Message ID:
00435486
Views:
50
I have these tables that need to be addressed in this query:
Requests      Prerequisites      Courses
--------      -------------      -------
ID            CourseID           ID
EmployeeID    PrerequisiteID     Name
CourseID
StatusID
The reqeusts table is a list of all the requests coming in from employees for courses. A course can have zero or more prerequisites therefor the prerequisites table would have data similar to the following:
CourseID 1 1 1 2 2 4 5 5 5
PrerequisiteID 2 3 4 3 4 6 3 4 6
Note: PrerequisiteID is also a link to the courses table.

The result I am trying to get from a query is for each request show what prerequisites the employee has completed and what ones the employee still needs to complete.

eg.
Request    Employee   Course   Prereq    Completed
1          2          1        2         0
1          2          1        3         0
1          2          1        4         1
2          2          2        3         0
2          2          2        4         1
3          2          3                           
4          3          1        2         1
4          3          1        3         1
4          3          1        4         1
Any help would be greatly appreciated. TIA.
Next
Reply
Map
View

Click here to load this message in the networking platform