Improve reduce functions of SQLite3 request

Steffen Mutter steffen at webanimations.de
Sun Feb 3 10:46:08 CET 2013


Hi,

I am writing some code to manage handball leagues more easy.
Problem:
MISSON: 
Get single club ids glued together with the shortest teamname.

EXAMPLE:
SELECT homenr as nr, home as club FROM Runde20122013  WHERE
place="karlsruhe" UNION SELECT guestnr as nr, guest as club FROM
20122013 WHERE place="karlsruhe" GROUP BY nr LIMIT 10

ACTUAL RESULT:
359|TV Calmbach
21101|SG Heidel/Helm
21236|JSG Neuth/Büch
23108|TG Eggenstein
23108|TG Eggenstein 2
23109|TV Ettlingenw
23109|TV Ettlingenw 2
23112|TSV Jöhlingen
23112|TSV Jöhlingen 2
23112|TSV Jöhlingen 3

NEEDED RESULT:
359|TV Calmbach
21101|SG Heidel/Helm
21236|JSG Neuth/Büch
23108|TG Eggenstein
23109|TV Ettlingenw
23112|TSV Jöhlingen

the nr needs to be unique together with the shortest clubname returned
by the where clause.

Any hints how to get this done either with SQLite3 tecneeqs or python
functions.

Kind regards.
SMut





More information about the Python-list mailing list