Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about task 8 in JOIN #8

Open
betterMax opened this issue Dec 10, 2021 · 1 comment
Open

A question about task 8 in JOIN #8

betterMax opened this issue Dec 10, 2021 · 1 comment

Comments

@betterMax
Copy link

Your correct code

SELECT DISTINCT player
FROM game
JOIN goal ON goal.matchid = game.id
WHERE (team1 = 'GER' OR team2 = 'GER')
AND teamid <> 'GER'

My wrong code

SELECT DISTINCT player
FROM game
JOIN goal ON goal.matchid = game.id 
WHERE (team1='GER' OR team2='GRE') 
AND teamid <> 'GER'

I really couldn't find the difference. But the answer is different. If I use your code, I can get one goal in match 1010 and one goal in match 2012. If I use my code, I can get two goals in 1001. The other four goals are the same. I am wondering if you can share your wisdom with me on this. Thanks a lot.

Btw here is the test link.

@akhil9506
Copy link

@betterMax I think you you should check either of team1 or team2 should be germany where as in your code you are checking team1 to germany and team2 to greece

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants