MÀSTER-1 MASCULÍ

SELECT nom as sujeto, dni as doc, sexe as sex1, categoria as cate, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=221 AND dni=doc ),0) AS dos, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=222 AND dni=doc ),0) AS una, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=223 AND dni=doc ),0) AS tres, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=224 AND dni=doc ),0) AS quatre, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=225 AND dni=doc ),0) AS cinc, IFNULL((SELECT puntscat FROM historic5 WHERE idcursa=226 AND dni=doc ),0) AS sis, SUM(puntscat) AS punts, SUM(empat) as desempat FROM historic5 WHERE categoria="MA1 M" GROUP BY dni ORDER BY punts DESC, desempat ASC..
Pos Nom AmpollaPerellóCamarlesTortosaDeltebreJesús Total Punts
1 MARTÍ JOVE, JOSEP 851151159310393 604 534
2 SALES CENTELLES, LLUIS 1150011500 230 230
3 ARASA ARASA, JUAN JOSE 0001031150 218 218
4 SANCHEZ RODRIGUEZ, JOSE FRANCISCO 00000115 115 115
5 TRILLO LUCENA, JOSE 10300000 103 103
6 ANDREU FERRANDO, XAVIER 00000103 103 103
7 CMADIERNO , JUAN 00103000 103 103
8 ROCA ALGUERÓ, JOAN 9300000 93 93
9 MUR BAGES, JOAN RAMON 0008500 85 85