I am new to SQL and I want to write a query to add multiple rows in a table.
For example:
Table:
matchid|player1id|player2id|player1score|player2score
101 |20 |10 |0 |100
101 |20 |10 |0 |100
101 |20 |10 |0 |100
201 |20 |10 |645 |0
201 |20 |10 |100 |700
201 |20 |10 |0 |100
Required output:
matchid|player1id|player2id|player1score|player2score
101 |20 |10 |0 |300
201 |20 |10 |745 |800
Note: I have to do this without using GROUP BY
SELECT matchid, player1id, player2id, player1score = SUM(player1score), player2score = SUM(player2score) FROM yourTable GROUP BY matchid, player1id, player2idGROUP BY?