Here's a SELECT query that I am having an issue with...
The 4 tables in question (and their fields and some basic input)
<TeamTable>
TeamID, TeamName, UserID
1,Alpha, Jane
1,Alpha, John
2,Beta,Cindy
3,Gamma,Tom
3,Gamma,Alice
3,Gamma,Betty
<ProjectsTable>
ProjectID, ProjectName, ProjectDescription
1,Upgrade, Upgrade to XP
2,Relocation, Move office
3,Website, Build new Intranet
4,Add Department, Add new department to Sales function
<ProjectMembersTable>
ProjectID, UserID
1,Jane
1,John
2,Tammy
3,Jack
4,Tom
4,Alice
4,Betty
<UsersTable>
UserID, UserName
John, John Doe
Tom, Tom Magnum
Alice, Alice Anderson
Betty, Betty Rubble
Here's the goal:
Have a user select a Team Name from a DropDownList on a web page. Pass TeamID to SQL and return output for all projects associated with that Team.
So, if they selected Team Gamma (ID of 3), the following Project should be returned: 4 (Add Department).
Pseduocode :Get Project(s) where everyone associated with a specific TeamID is also a member of the specified Project.
How is that written in T-SQL?
Start Free Trial