summaryrefslogtreecommitdiff
path: root/remove-badges-variants.mysql
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2010-05-10 17:36:26 +0200
committerHugues Hiegel <hugues@hiegel.fr>2010-05-10 17:36:26 +0200
commitc187cb0a45231b91018b318cd6494123fa4e221a (patch)
tree72de0822aab12fa1445a0c535152680d6dd7988e /remove-badges-variants.mysql
parent86bfbbad119f7ae4793696dddf36ace93dfddf43 (diff)
[DataBase] little cleanup
Diffstat (limited to 'remove-badges-variants.mysql')
-rw-r--r--remove-badges-variants.mysql32
1 files changed, 0 insertions, 32 deletions
diff --git a/remove-badges-variants.mysql b/remove-badges-variants.mysql
deleted file mode 100644
index 3f29d2a..0000000
--- a/remove-badges-variants.mysql
+++ /dev/null
@@ -1,32 +0,0 @@
-
-USE lastfm
-
-
-/**
- * Deletes all entries in badges
- * for each unique username + type
- * where more than one style or color exists
- */
-
-DROP TABLE IF EXISTS tmp ;
-CREATE TEMPORARY TABLE tmp (SELECT username, type, COUNT(username) AS count FROM badges GROUP BY username, type ) ;
-
-SELECT badges.png
- FROM badges, tmp
- WHERE badges.username = tmp.username
- AND ( (badges.type = tmp.type AND tmp.count > 1)
- OR ( (badges.type LIKE concat(tmp.type,"%") OR tmp.type LIKE concat(badges.type,"%"))
- AND badges.type != tmp.type )
- ) ;
-
-DELETE badges.*
- FROM badges, tmp
- WHERE badges.username = tmp.username
- AND ( (badges.type = tmp.type AND tmp.count > 1)
- OR ( (badges.type LIKE concat(tmp.type,"%") OR tmp.type LIKE concat(badges.type,"%"))
- AND badges.type != tmp.type )
- ) ;
-
-
-DROP TABLE tmp ;
-