VETERÀ-1 FEMENÍ

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="VE1 F" GROUP BY dni ORDER BY punts DESC, desempat ASC..
Pos Nom AmpollaPerellóCamarlesTortosaDeltebreJesús Total Punts
1 SÁNCHEZ FIGUERES , MIREIA 1159393103103103 610 532
2 ZARAGOZA GRANELL, SUSANA 01031151159393 519 519
3 CÓRDOVA ANDINO , YESENIA 0115103938579 475 475
4 MONTEVERDE MICHAVILA, MONICA 1037975717173 472 416
5 FANDOS COLOMINES, ESTIBALIZ 738573737575 454 396
6 BIARNÉS JORNET, MªDOLORS 0079797985 322 322
7 MARTOS REDO , IOLANDA 7907070670 286 286
8 GALVE CURTO, LUCI 0000115115 230 230
9 COMÍ CODINA , SÒNIA 707500071 216 216
10 FORT RODRIGUEZ, ROSANA 00858500 170 170
11 MORALES TOMÀS , PATRICIA 75071000 146 146
12 CUGAT ADELL, GEMMA 00690070 139 139
13 MONTAÑA VALLÉS, CARME 9300000 93 93
14 VILANOVA BAIGES, SÍLVIA 8500000 85 85
15 FATSINI YAGÜE, ERICA 0007500 75 75
16 SANCHEZ IGLESIAS, MARI 0000730 73 73
17 POQUET TARRAGO, NOEMI 7100000 71 71
18 SÁNCHEZ IGLESIAS, NOLI 0000700 70 70
19 CABRERA ROCH, CARME 0000690 69 69
20 VORONINA, ANNA 0000069 69 69
21 LARA, CLARISA 6900000 69 69
22 BLANQUET BAYERRI, MONTSE 0000680 68 68
23 RODRÍGUEZ AUBÀ, EUGÈNIA 0068000 68 68
24 VILANOVA BAIGES, MERITXELL 6800000 68 68
25 OBIOL ESPELTA, VALLIVANA 0000660 66 66