Need Help with SQL
August 23, 2007 at 11:36 pm 1 comment
At work, we have a huge user table with all the email addresses. We also have a column acting as a counter that we increment when certain things happen. Recently we found that the counter got incremented on 99% of the email addresses all at once and that really screwed things up. By digging through MySQL logs, I finally found the offending SQL statement (with fake database.table and column name):
UPDATE database.table SET counter = counter + 1 WHERE email = 'In>Ng;>.|-vcduee YSZTM||I!8e1CIVY?oUO<<ACNanZTMabp*TyaIiaE u\"{XSXveZ|'a=$hB|Fa1Tu?ZObP@cbk3n`0RI..C89-WoTc0Eciie5NSPI2q3...pp(..c]0I*|o27r,,p9Q.....ZTobHIETyYP'-'!#0SaaFAO'
That is one crazy WHERE condition clause. Can anyone see why it matches 99% of the email addresses I have in the table? There is not going to be any prize for figuring it out for me unfortunately but I appreciate any feedback on this! Thanks.
Entry filed under: MySQL. Tags: .
1.
Patate | August 25, 2007 at 4:35 am
I dont even know how that comparison can run.
curious to know why it does what it does though.