class="s-table-container">
Result_ID
Season_ID
1
1 < /td>
< /tr>
2 < /td>
1 < /td>
< /tr>
4 < /td>
2
< /br /tr>
/> 4 < /td>
2 < /td>
< /tr>
… < /td>
… < /td>
< /tr>
37
/> < /tr>
38 < /td>
5 < /td>
< /tr>
< /tbody>
< /table> < /div>
игроки < /strong> < /p>
< /div>
< /strong> < /p>
< /div>
< /strong> < /p>
< /div>
< /strong> < /p>
< /div>
игроки < /tbstic> < /p>
Код: Выделить всё
Player_ID | Player | Player_Type | Player_Order
1 Fred Defender-Left 1
2 Bert Defender-Left 1
3 Joe Defender-Right 2
4 Harry Midfielder 3
5 Simon Midfielder 3
6 Tate Striker 4
7 Graeme Striker 4
8 Jeff Keeper 5
… … … …
Код: Выделить всё
PointType_ID | L1_Value | L2_Value | Point_Value | L1_Order
1 Appearance Keeper 1 1
2 Appearance Outfield 1 1
3 Goal Keeper 4 1
4 Goal Outfield 4 1
5 Assist Keeper 3 1
6 Assist Outfield 3 2
… … … … …
Код: Выделить всё
Point_ID | Player_ID | Result_ID | PointType_ID
1 1 1 1
2 2 1 2
3 3 1 2
… … … …
1 1 37 1
2 2 37 2
3 3 37 2
2 4 37 2
3 6 37 2
4 4 37 6
6 6 37 4
1 1 38 1
2 2 38 2
3 3 38 2
2 4 38 2
3 5 38 2
4 2 38 4
6 5 38 6
< /code>
Я пытаюсь запустить запрос, который дает следующий набор результатов: < /p>
Player_Order | Player_Type | Player_ID | Player_Name | Sum(Point_Value) | Season_ID
1 Defender-Left 1 Fred 2 5
1 Defender-Left 2 Bert 6 5
2 Defender-Right 3 Joe 2 5
3 Midfielder 4 Harry 5 5
3 Midfielder 5 Simon 4 5
4 Striker 6 Tate 5 5
… … … … … …
< /code>
Следующий запрос предоставляет все данные, которые я хочу (за исключением поля Season_id). < /p>
SELECT Players.Player_Order, Players.Player_Type, Players.Player_ID, Players.Player, SUM(PointTypes.Point_Value) AS Points
FROM Points, Players, PointTypes AS PT
WHERE Players.Player_ID = Points.Player_ID AND Points.PointType_ID = PointType.PointType_ID
GROUP BY Player_ID
ORDER BY Player_Order, Points DESC, Player;
Подробнее здесь: https://stackoverflow.com/questions/797 ... on-in-join
Мобильная версия