VETERÀ-1 MASCULÍ

SELECT nom as sujeto, dni as doc, sexe as sex1, categoria as cate, IFNULL((SELECT puntscat FROM historic WHERE idcursa=130 AND dni=doc ),0) AS una, IFNULL((SELECT puntscat FROM historic WHERE idcursa=131 AND dni=doc ),0) AS dos, IFNULL((SELECT puntscat FROM historic WHERE idcursa=132 AND dni=doc ),0) AS tres, IFNULL((SELECT puntscat FROM historic WHERE idcursa=133 AND dni=doc ),0) AS quatre, IFNULL((SELECT puntscat FROM historic WHERE idcursa=134 AND dni=doc ),0) AS cinc, IFNULL((SELECT puntscat FROM historic WHERE idcursa=135 AND dni=doc ),0) AS sis, IFNULL((SELECT puntscat FROM historic WHERE idcursa=136 AND dni=doc ),0) AS siet, IFNULL((SELECT puntscat FROM historic WHERE idcursa=137 AND dni=doc ),0) AS vuit, IFNULL((SELECT puntscat FROM historic WHERE idcursa=138 AND dni=doc ),0) AS nou, IFNULL((SELECT puntscat FROM historic WHERE idcursa=139 AND dni=doc ),0) AS deu, IFNULL((SELECT puntscat FROM historic WHERE idcursa=140 AND dni=doc ),0) AS once, SUM(puntscat) AS punts, SUM(empat) as desempat FROM historic WHERE categoria="VE1 M" GROUP BY dni ORDER BY punts DESC, desempat ASC..
Pos Nom AmpostaL'AmpollaUlldeconaPerellóS.BàrbaraCamarlesTortosaJesúsDeltebreLa GaleraL'Aldea Total Punts
1 JUAN-CAMPS CASTELL, AGUS 1150000000000 115 115
2 SOWE , MUSA 1030000000000 103 103
3 ALEMANY SEBASTIA , SAMUEL 930000000000 93 93
4 CABALLÉ ANDREU, ENRIC 850000000000 85 85
5 GINÉ CID, ALBERT 790000000000 79 79
6 SOTA MARTÍ, JORDI 750000000000 75 75
7 ALBESA ABADAL, ANDRES 730000000000 73 73
8 QUERAL FORCADELL, DAVID 710000000000 71 71
9 ASÍN QUEROL, JAVI 700000000000 70 70
10 VALLESPI DE LA CRUZ, JORDI 690000000000 69 69
11 CASTELLS LOPEZ, RAMON 680000000000 68 68
12 ULLDEMOLINS TODÓ, ALFONS 670000000000 67 67
13 ZARAGOZA VALLDEPEREZ, RAMON 660000000000 66 66
14 PIQUERA NARANJO , OSCAR 650000000000 65 65
15 CORTÉS CALVO, MANU 640000000000 64 64
16 TOMAS PORRES, CARLOS 630000000000 63 63
17 SORIANO LOPEZ, ANTONIO 620000000000 62 62
18 SOTOMAYOR DUQUE, XAVI 610000000000 61 61
19 MARTOS MARTI, ANGEL 600000000000 60 60
20 VALMAÑA, ELOY 590000000000 59 59
21 ESCODA MARTIN, ISMAEL 580000000000 58 58
22 QUERALT ROIG, DANI 570000000000 57 57
23 REDO PRINCEP, RICARD 560000000000 56 56
24 VILLAR MORERA, JOSE LUIS 550000000000 55 55
25 FORNÓS MONLLAU, MARC 540000000000 54 54
26 TALARN CAUBET, JOAQUIM 530000000000 53 53
27 GUART AUXACHS, JOAN 520000000000 52 52
28 ROMEU ESQUERRÉ, FERNANDO 510000000000 51 51
29 QUIRÓS PONFERRADA, DAVID 500000000000 50 50
30 SEBASTIA VALLDEPEREZ, JORDI 490000000000 49 49
31 SERRA TORTA, ANTON 480000000000 48 48
32 JUAN APARICIO, SANTI 470000000000 47 47
33 TOLDA GIL, MANEL 460000000000 46 46
34 SERRET GOMEZ, JUAN CARLOS 450000000000 45 45
35 LUCAS JARDI, DAVID 440000000000 44 44
36 GUERRERO MONTAÑES, FRANCISCO JAVIER (PAT 430000000000 43 43
37 ACCENSI CASAJUST, JOEL 420000000000 42 42
38 CASTELLS FABRA, LLUIS 410000000000 41 41
39 ESPINOSA VILLAR, BORJA 400000000000 40 40