VETERÀ-2 FEMENÍ

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 tres, IFNULL((SELECT puntscat FROM historic WHERE idcursa=132 AND dni=doc ),0) AS dos, 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, SUM(puntscat) AS punts, SUM(empat) as desempat FROM historic WHERE categoria="VE2 F" GROUP BY dni ORDER BY punts DESC, desempat ASC..
Pos Nom AmpostaL'AmpollaUlldeconaPerellóS.BàrbaraCamarlesTortosaDeltebreLa GaleraJesús Total Punts
1 TURTÓS PALOMA, NÚRIA 103103093791031151031030 802 802
2 DOMINI VIDAL, SILVIA 115011510385010311500 636 636
3 BATALLA DOMINGUEZ, SITA 01150115103115001150 563 563
4 GONZALEZ SABATE, TRINI 71079757175079750 525 525
5 LLAMBRICH PARRA, MONICA 001038500093850 366 366
6 SEGURA RIUS, ELENA 73750790790000 306 306
7 AGUEYO BENITO, MILA 0797573000000 227 227
8 ROJAS PEREZ, CARMEN 085930000000 178 178
9 CLUA I GAYA, MARISA 000008508500 170 170
10 ALMEIDA JIMENEZ, MONICA 000073000790 152 152
11 ROIG CASTELL, EVA 000011500000 115 115
12 ARASA SUBIRATS, MARISIN 00009300000 93 93
13 RIBOT VALLÉS, MAITE 00000000930 93 93
14 QUERAL MOLINÉ, EVELIN 00000930000 93 93
15 SANCHEZ HURTADO, CARMEN 93000000000 93 93
16 DRECKER, SABINE 09300000000 93 93
17 BERMEJO MULET, MONTSE 85000000000 85 85
18 CALVET ESCUIN, JÚLIA 00850000000 85 85
19 PERPIÑA CUEVAS, MAR 79000000000 79 79
20 CERDÀ GARCIA, MONTSE 00007500000 75 75
21 GARCIA ESTELLE, MARIA JOSÉ 75000000000 75 75
22 MORA GRATACOS, IRENE 00000730000 73 73