lachose
Regular
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 :
Query :
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) :
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)
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;
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)