This UGLY query works for a maximum of 4 replacements per line. If you need more replacements, the best way is to create a custom function to replace these words on one line and use it to update.
UPDATE table1 a LEFT JOIN lookup b1 on a.username LIKE CONCAT('%', b1.`WRONG`, '%') LEFT JOIN lookup b2 on a.username LIKE CONCAT('%', b2.`WRONG`, '%') and (b2.Wrong not in (b1.Wrong)) LEFT JOIN lookup b3 on a.username LIKE CONCAT('%', b3.`WRONG`, '%') and (b3.Wrong not in (b1.Wrong,b2.Wrong)) LEFT JOIN lookup b4 on a.username LIKE CONCAT('%', b4.`WRONG`, '%') and (b4.Wrong not in (b1.Wrong,b2.Wrong,b3.Wrong)) SET a.username = REPLACE( REPLACE( REPLACE( REPLACE(a.username, IFNULL(b1.`WRONG`,''), IFNULL(b1.`RIGHT`,'')) , IFNULL(b2.`WRONG`,''), IFNULL(b2.`RIGHT`,'')) , IFNULL(b3.`WRONG`,''), IFNULL(b3.`RIGHT`,'')) , IFNULL(b4.`WRONG`,''), IFNULL(b4.`RIGHT`,''))
valex
source share