Creating a Pivot (crosstab) query for a golf league [on hold]

27
February 12, 2019, at 10:00 AM

I’m trying to create a pivot query (Cross Tab)for a golf league with about 20 players. In my database I place the playerID, Name, Date, Round#(1,2,3, etc) and score. Round number is necessary because a player may play multiple rounds per day.

I do not know how many round will be in the columns because each player will have a different number based on the number of rounds played each season.

(1) My data table will be one row for each round.

My pivot query should be one row per player. should be like

Name Round1 Round2 Round3 Round4 Round5 ( 1-5 or 1 – 25) bases on the number of rounds. This would be column names.

Any help will be appreciated. My select query for (1) would be Select PlayerID, PlayerName, Date, RoundNo, Score From tblScores Group By PlayerID Order by Date ASC, RoundNo ASC

Answer 1

I did not fully understand your question, but you could try something like:

SELECT PlayerID, PlayerName, Date, Count(Round) AS RoundNo, Score
FROM tblScores
GROUP BY PlayerID
ORDER BY Date ASC, RoundNo ASC
READ ALSO
Access denied for user root@localhost on Ubuntu and OS X

Access denied for user root@localhost on Ubuntu and OS X

I'm developing a web application and it is working just fine in Windows, but now I'm trying to run it in Ubuntu and in a Macbook and it's giving me a Access denied error

23
Question marks returned instead of Arabic characters ONLY when xampp servers are launched from within program

Question marks returned instead of Arabic characters ONLY when xampp servers are launched from within program

As the title says, question marks are returned only when I run mysqldexe and httpd

42
MySQL - sub query on the same table [duplicate]

MySQL - sub query on the same table [duplicate]

This question already has an answer here:

25
How to update image in mysql database using angularjs [on hold]

How to update image in mysql database using angularjs [on hold]

I am learning angularjsBut I am fetching some problem in image updating

44