I have the following SQLite 3 table schema:
CREATE TABLE rolestats (player TEXT, role TEXT, teamwins SMALLINT, individualwins SMALLINT, totalgames SMALLINT, UNIQUE(player, role));
Some sample data:
sqlite> SELECT * FROM rolestats WHERE player LIKE "%rika%" LIMIT 10;
rika|jester|0|3|4
rika|guardian angel|0|0|1
rika|clone|0|1|1
rika|village elder|1|0|1
rika|village drunk|7|5|10
rika|cultist|5|0|15
rika|detective|3|2|4
rika|wolf cub|7|3|11
Rika|wolf|0|0|1
Rika|shaman|2|1|2
As you can see, the name has different capitalizations. It uses IRC account names, but they can be changed. There are cases when they differ in more than just case, too. For this particular case, case-insensitivity is planned but not something we have yet.
Here's what I've come up with:
SELECT role, SUM(teamwins), SUM(individualwins), SUM(totalgames) FROM rolestats WHERE player LIKE "%rika%" GROUP BY role;
I've already done this once before, but now I can't figure out how to insert the result of this query into player = "rika"
and delete the other player name variants.
Aucun commentaire:
Enregistrer un commentaire