Peter Brawley said:
SELECT
...,
GROUP CONCAT(LPAD(strokes,3,' ') SEPARATOR '') AS ' 1 2 3 4 5 6 7
8 9'
FROM tour_player_score tps
INNER JOIN tour_scorecard_hole tsh ON tps.scorecard_hole_id=tsh.id
WHERE tour_player_id=175
GROUP BY tsh.id
***********************************************
This worked, however, it gives me all results in one cell. I would like to
have them sorted in one cell per strokes. Is that possible? The reason for
this is that I have to use each hole as ORDER criteria. If the SUM is equal,
then I have to check the sum of the last nine holes. If they are the same,
then I have to check the result of hole 18, 17, 16 etc.
This is my exact query as is now:
SELECT tps.tour_player_id, GROUP_CONCAT(LPAD(strokes,2,' ') SEPARATOR '-')
AS hole_scores, sum(tps.strokes) AS 'score' FROM tour_player_score tps INNER
JOIN tour_scorecard_hole tsh ON tps.scorecard_hole_id=tsh.id GROUP BY
tps.tour_player_id ORDER BY score;
Best regards,
Peter Lauri