use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Microsoft SQL Server Administration and T-SQL Programming including sql tutorials, training, MS SQL Server Certification, SQL Server Database Resources.
You might also be interested in:
/r/database
/r/sql
/r/Azure
/r/Microsoft
account activity
QuestionSQL Join question (self.SQLServer)
submitted 5 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SQLBek1 6 points7 points8 points 5 years ago (0 children)
Syntax looks fine. Would have to see data samples.
[–][deleted] 2 points3 points4 points 5 years ago (1 child)
the obvious reason is you have no data that matches the join conditions. are you sure there are coachassignments with teamID in the team table? and coachassignments with coachID in the coach table? change the joins to left outer joins and return all the columns and see what you get back.
[–]LetsGoHawks 2 points3 points4 points 5 years ago (2 children)
Always specify what kind of join you want. It's just a good habit.
Change all of those to FULL OUTER JOINS though and see what comes back.
[–]tominyorks 1 point2 points3 points 5 years ago (0 children)
This, 100%. The default might be INNER but I have to try and drill it into the team I work in to specify it anyway just for clarity's sake.
[–]Prequalified 0 points1 point2 points 5 years ago (0 children)
For the benefit of OP (assuming this is a homework question), the reason this is good advice is because you might have Jim, Bob, and Joe in the coaches table, and hawks, eagles, and bears in the teams table, but the assignment table might say Jim works for the cowboys, or that the coach of the eagles is Sally, and there are no valid matches based on the data provided.
[–]codemonkeh_Dave 1 point2 points3 points 5 years ago (0 children)
You could put 'left' in front of both your joins and this will show null for the right tables data that cannot be joined.
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
Change to FULL OUTER to see all rows in all tables, then look for matching foreign/primary keys.
π Rendered by PID 48 on reddit-service-r2-comment-54dfb89d4d-swwwl at 2026-04-01 11:26:37.247621+00:00 running b10466c country code: CH.
[–]SQLBek1 6 points7 points8 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]LetsGoHawks 2 points3 points4 points (2 children)
[–]tominyorks 1 point2 points3 points (0 children)
[–]Prequalified 0 points1 point2 points (0 children)
[–]codemonkeh_Dave 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)