I'm currently developing a MySQL query that counts different totals of people who bet in certain categories. Say Pro Baseball, Flex, World Cup, ULeague. The thing is Flex and World Cup is counted as one.
My SQL code so far
SELECT COALESCE(`category_desc`,'Total') AS ALLGAMES,
COUNT(DISTINCT `player_id`) AS 'No. of Person',COUNT(`bet_id`) AS 'No. of Bets' FROM `bet`
WHERE `category_desc` IN ('World Cup','Flexi','ULeague','Pro Baseball')
GROUP BY ALLGAMES WITH ROLLUP
Result:
+----------+---------------+-----------+
| ALLGAMES | No. of Persons| Bet Count |
+----------+---------------+-----------+
|Flexi | 723 | 100,100|
|ProBasebal| 247 | 400,000 |
|World Cup | 709 | 20,375 |
|ULeague | 1000 | 5,311 |
+----------+---------------+-----------+
Is the following result possible thru sql statement?
+----------+---------------+-----------+
| ALLGAMES | No. of Persons| Bet Count |
+----------+---------------+-----------+
|Flexi/WCup| 1432 | 120,475|
|ProBasebal| 247 | 400,000 |
|ULeague | 1000 | 5,311 |
+----------+---------------+-----------+
Say We'd like to combine the data of Flexi
and World Cup
.
And Also is it possible to arrange the games by custom order?
Like ULeague comes first, next would be ProBasebal.