Problem. Please help :) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem. Please help :)

Hello, Can someone help please. I have a table with a player_home, player_away, team_home, team_away, score_home, score_away player_home always has team_home and score_home. player_away always has team_away and score_away Problem is on one row the player 'Rob' can be player_home and the next row he is player_away. What I wanna get out of this table is.. How many times did 'Rob' win a game? How can I query this? I appreciate the help! :-)

22nd Jan 2017, 9:38 PM
Jorden
Jorden - avatar
2 Answers
+ 1
first create an extra field as player ID then you can apply inner joint and create a new table and easily calculate the wins of player
22nd Jan 2017, 10:02 PM
Keshave Jat
Keshave Jat - avatar
+ 1
use union, first query calculate when 'Rob' win a game as a player_home and the second query as a player_away
23rd Jan 2017, 12:13 AM
xcoder