Hi,

Background: I run a prediction league for soccer
competitions. For every game, I want to show how many
predictions were submitted per scoreline, ie.

10% said 1-0
20% said 0-1
30% said 2-3
etc.

My prediction table has a predictionA and predicionB
column with the submitted scores.

Currently I do something like SELECT MAX(predictionA),
MAX(predictionB) and then check for all the possible
scorelines... if I got 2 and 3, then the possibilities
would be:

2-0, 2-1, 2-2, 2-3
1-0, 1-1, 1-2, 1-3
0-0, 0-1, 0-2, 0-3

If the count for any predictions is 0 (ie no-one
prediction that score), it gets omitted rather than
saying "0%".

These I do with individual selects in a code "for
loop". Is there a better way to do this with less
calls to the database?

Thanks!


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to