Hippolyte was so pissed to be 4th again this week-end he asked me to check who got 4th the most without having a 3x3 podium in the final round ever. (I hope the previous sentence is understandable^^)
So here we go :
Code:
+------------+----------------------------+-----------------+----+
| personId   | personName                 | personCountryId | nb |
+------------+----------------------------+-----------------+----+
| 2008MORE02 | Hippolyte Moreau           | France          |  5 |
| 2011KULS01 | Ayush Kumar                | India           |  3 |
| 2009VALL01 | Cristobal Correa del Valle | Chile           |  3 |
| 2004SECH01 | François Sechet            | France          |  3 |
| 2004ROUX01 | Gilles Roux                | France          |  3 |
| 2006JAEY01 | JaeYoung Chun (천재영)      | Korea           |  3 |
| 2008CAMP01 | Pablo Ruiz Campos          | Mexico          |  3 |
| 2008CRAW01 | Simon Crawford             | United Kingdom  |  3 |
+------------+----------------------------+-----------------+----+
8 rows in set (1.52 sec)
Query :
select t1.personId, t1.personName, t1.personCountryId, t1.nb from (select personId, personName, personCountryId, count(*) as nb from Results where eventId="333" and roundId="f" and pos=4 group by personId,personName) t1 left outer join (select distinct personId from Results where eventId="333" and roundId="f" and pos<4) t2 on t1.personId=t2.personId where t2.personId is null order by t1.nb desc, personName asc limit 8;
I displayed only 8 results because the others have less than 3 occurrences so I think it's useless to display them.

And here is the query for the people who got 4th the most (without the non-podium contraint) :
Code:
mysql> select personName, personId, personCountryId, count(*) from Results where pos="4" and roundId="f" and eventId="333" group by personId order by count(*) desc, personName limit 19;
+------------------------------+------------+-----------------+----------+
| personName                   | personId   | personCountryId | count(*) |
+------------------------------+------------+-----------------+----------+
| Jeremy Fleischman            | 2005FLEI01 | USA             |        7 |
| Sinpei Araki (荒木慎平)       | 2006ARAK01 | Japan           |        7 |
| Maarten Smit                 | 2008SMIT04 | Netherlands     |        6 |
| Piotr Alexandrowicz          | 2007ALEX01 | Poland          |        6 |
| Ron van Bruchem              | 2003BRUC01 | Netherlands     |        6 |
| Edward Lin                   | 2008LINE02 | USA             |        5 |
| Erik Akkersdijk              | 2005AKKE01 | Netherlands     |        5 |
| Hippolyte Moreau             | 2008MORE02 | France          |        5 |
| Joey Gouly                   | 2007GOUL01 | United Kingdom  |        5 |
| Lars Vandenbergh             | 2003VAND01 | Belgium         |        5 |
| Massimiliano Iovane          | 2009IOVA01 | Italy           |        5 |
| Milán Baticz                 | 2005BATI01 | Hungary         |        5 |
| Mitsuki Gunji (郡司光貴)      | 2006GUNJ01 | Japan           |        5 |
| Nobuaki Suga (菅 信昭)        | 2007SUGA01 | Japan           |        5 |
| Philippe Virouleau           | 2008VIRO01 | France          |        5 |
| Piotr Frankowski             | 2006FRAN01 | Poland          |        5 |
| Piotr Kózka                  | 2005KOZK01 | Poland          |        5 |
| Riccardo Simone              | 2008SIMO01 | Italy           |        5 |
| Tim Reynolds                 | 2005REYN01 | USA             |        5 |
+------------------------------+------------+-----------------+----------+
19 rows in set (0.73 sec)
 
Hippolyte was so pissed to be 4th again this week-end he asked me to check who got 4th the most without having a 3x3 podium in the final round ever. (I hope the previous sentence is understandable^^)
So here we go :[/spoiler]

You're missing combined finals (roundId "c", so you can use this code: roundId in ("f","c")). Doesn't change your result, though.
 
You're missing combined finals (roundId "c", so you can use this code: roundId in ("f","c")). Doesn't change your result, though.
I thought about that at first but I said to myself "nobody does a Combined Final for 3x3". But you're right, I should have include it to be sure.
But Kumar 80%, Moreau only 25!
Are you sure about this percentage ? It seems odd to me.
I see 3/6 for Kumar so 50% and 5/14 for Moreau so ~36%
 
Also, is "c" only for combined finals ? Doesn't it include combined first too ?

Code:
mysql> select * from Rounds order by rank;
+----+------+------------------------+------------------------+
| id | rank | name                   | cellName               |
+----+------+------------------------+------------------------+
| h  |   10 | Combined qualification | Combined qualification |
| 0  |   19 | Qualification round    | Qualification          |
| d  |   20 | Combined First round   | Combined First         |
| 1  |   29 | First round            | First                  |
| b  |   39 | B Final                | B Final                |
| 2  |   50 | Second round           | Second                 |
| e  |   59 | Combined Second round  | Combined Second        |
| g  |   70 | Combined Third round   | Combined Third         |
| 3  |   79 | Semi Final             | Semi Final             |
| c  |   90 | Combined Final         | Combined Final         |
| f  |   99 | Final                  | Final                  |
+----+------+------------------------+------------------------+
 
Are you sure about this percentage ? It seems odd to me.
I see 3/6 for Kumar so 50% and 5/14 for Moreau so ~36%

I was wrong!
 
Back
Top