Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mavericky
Posting Yak Master
117 Posts |
Posted - 2011-10-20 : 06:53:07
|
Hi,I have 3 tables:Employee, Team, ConnectionEmployeeEID EName Rank1 A 12 B 23 C 3TeamTID TName Day11 AA M12 BB T13 CC WConnectionEmpID TeamID1 112 123 13 I want the result to be like this:TID TName Day EID EName Rank 11 AA M 1 A 1 12 BB T 2 B 2 13 CC W 3 C 3Is it possible to get this result?Thanks,Mavericky |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-10-20 : 07:14:26
|
Yes. It looks like it should be really simple. When is the assignment due?JimEveryday I learn something that somebody else already knew |
|
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2011-10-20 : 07:38:54
|
[code]SELECT t.TID AS [Team ID], t.TName AS [Team Name], t.Day AS [Team Day], e.EID AS [Employee ID], e.EName AS [Employee Name], e.Rank AS [Employee Rank]FROM connection cINNER JOIN team t ON c.TeamID = t.TID INNER JOIN employee e ON c.EmpID = e.EID[/code]G |
|
|
jassi.singh
Posting Yak Master
122 Posts |
Posted - 2011-10-20 : 08:12:23
|
Try thisSELECT team.TID,team.TName,team.Day,Employee.EID,Employee.EName,Employee.RankFROM connection INNER JOIN employee ON connection.EmpID = employee.EIDINNER JOIN team ON connection.TeamID = team.TIDPlease mark answer as accepted if it helped you.Thanks,Jassi Singh |
|
|
|
|
|
|
|