Posted by David Ehmer on 10/13/47 11:40
I have a query (see below) which returns username, round number and total
score for each round of a tipping competition.
SELECT tips.username, fixtures.round,
SUM(CASE
WHEN tips.tip='draw' AND fixtures.result='draw' then 2
WHEN tips.tip=fixtures.result then 1
else 0 end) points
FROM fixtures
JOIN tips on (fixtures.round=tips.round AND fixtures.game=tips.game)
GROUP BY tips.username, fixtures.round
LIMIT 0,50"
An example of the output is:
username round points
Angela 10 8
Angela 11 2
ehmer 10 5
Just not sure how to display it correctly. An example of how I need iy to
display in a table is below: (or see
http://www.insideliquor.com.au/footytips/ladder.php)
username round1 round2 round3 round4 total
joe 5 8 6 4
23
bob 2 3 3 2
10
Appreciate any suggestions
David
[Back to original message]
|