You are here: Manipulating query results in a table « PHP SQL « IT news, forums, messages
Manipulating query results in a table

Posted by David Ehmer on 09/30/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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация