This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on UTF-8 Encoding Debugging Chart: http://www.i18nqa.com/debug/utf8-debug.html | |
UPDATE table SET field = replace(field, '€', '€'); | |
UPDATE table SET field = replace(field, '‚', '‚'); | |
UPDATE table SET field = replace(field, 'Æ’', 'ƒ'); | |
UPDATE table SET field = replace(field, '„', '„'); | |
UPDATE table SET field = replace(field, '…', '…'); | |
UPDATE table SET field = replace(field, '†', '†'); | |
UPDATE table SET field = replace(field, '‡', '‡'); | |
UPDATE table SET field = replace(field, 'ˆ', 'ˆ'); | |
UPDATE table SET field = replace(field, '‰', '‰'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In an utf-8 table | |
UPDATE mytable SET | |
field = CONVERT(CAST(CONVERT(field USING latin1) AS BINARY) USING utf8); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE mytable SET field = replace(field, 'search_for', 'replace_with'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT mytable.id +1 | |
FROM mytable | |
WHERE ( mytable.id +1 ) | |
NOT IN ( | |
SELECT mytable.id | |
FROM mytable | |
) | |
ORDER BY id | |
LIMIT 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- "Lastname, Firstname" to "Firstname Lastname" | |
UPDATE mytable set field = CONCAT( | |
TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(field,',',2),',',-1)), | |
' ', | |
TRIM(SUBSTRING_INDEX(field,',',1)) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Find Duplicates and group by duplicated value | |
SELECT field, COUNT(*) | |
FROM mytable GROUP BY field | |
HAVING count(*) > 1 | |
-- Find Duplicates and list each row | |
SELECT a.field, a.target_field | |
FROM mytable a | |
INNER JOIN ( | |
SELECT target_field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formatResult: function (suggestion, currentValue) { | |
var keywords = currentValue.split(" "); | |
var suggest = suggestion.value; | |
$(keywords).each(function() { | |
suggest = suggest.replace(new RegExp('(' + this + ')(?![^<]*>|[^<>]*</)', 'gi'), '<strong>' + this + '</strong>'); | |
}); | |
return suggest; | |
} |