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 11593931031030 507 507
2 ZARAGOZA GRANELL, SUSANA 0103115115930 426 426
3 MONTEVERDE MICHAVILA, MONICA 103797571710 399 399
4 CÓRDOVA ANDINO , YESENIA 011510393850 396 396
5 FANDOS COLOMINES, ESTIBALIZ 73857373750 379 379
6 MARTOS REDO , IOLANDA 7907070670 286 286
7 BIARNÉS JORNET, MªDOLORS 007979790 237 237
8 FORT RODRIGUEZ, ROSANA 00858500 170 170
9 MORALES TOMÀS , PATRICIA 75071000 146 146
10 COMÍ CODINA , SÒNIA 70750000 145 145
11 GALVE CURTO, LUCI 00001150 115 115
12 MONTAÑA VALLÉS, CARME 9300000 93 93
13 VILANOVA BAIGES, SÍLVIA 8500000 85 85
14 FATSINI YAGÜE, ERICA 0007500 75 75
15 SANCHEZ IGLESIAS, MARI 0000730 73 73
16 POQUET TARRAGO, NOEMI 7100000 71 71
17 SÁNCHEZ IGLESIAS, NOLI 0000700 70 70
18 CABRERA ROCH, CARME 0000690 69 69
19 CUGAT ADELL, GEMMA 0069000 69 69
20 LARA, CLARISA 6900000 69 69
21 BLANQUET BAYERRI, MONTSE 0000680 68 68
22 RODRÍGUEZ AUBÀ, EUGÈNIA 0068000 68 68
23 VILANOVA BAIGES, MERITXELL 6800000 68 68
24 OBIOL ESPELTA, VALLIVANA 0000660 66 66