Reputation: 1477
Need some assistance with an SQL query. The relational view is below:
The output should show Project Name, Project Manager Username, and Project Due Date. The difficulty is that the above output must be shown for which a specific worker who is assigned to a task inside of that project. So for example, Task 'B.1' is added to Project 'B', a worker is assigned to Task 'B.1' would see the above output for Project 'B'.
Hope this makes sense.
EDIT: I need the ProjectID and WorkerID as well to pass the ID and for a Where clause.
Upvotes: 1
Views: 74
Reputation: 789
try this
select project.projectid, project.name, managers.username, project.duedate, task.workerid from project
inner join task on project.projectid = task.projectid
inner join user as managers on project.projectmanagerid = managers.userid
inner join user as workers on task.workerid = workers.userid
Upvotes: 2
Reputation: 757
If I understand what you want, this is another way to do it, it should be something like this :
SELECT Project.Name, User.FirstName, Project.DueDate
FROM Project, User, Task
WHEN User.ProjectManagerID = User.UserID
AND Project.ProjectID = Task.Project ID
I think that's all.
Upvotes: 0