Nehmen wir an, ich habe so etwas
uid tag
1 HeLLo
2 heLLO
3 HELLO
4 hello
Wie kann ich alle Werte in der Spalte "Tag" aktualisieren auf:
uid tag
1 hello
2 hello
3 hello
4 hello
mit MySQL?
Nehmen wir an, ich habe so etwas
uid tag
1 HeLLo
2 heLLO
3 HELLO
4 hello
Wie kann ich alle Werte in der Spalte "Tag" aktualisieren auf:
uid tag
1 hello
2 hello
3 hello
4 hello
mit MySQL?
Antworten:
Siehe http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_lower
UPDATE table_name SET tag = LOWER(tag)
UPDATE table_name SET tag = BINARY LOWER(tag)für Matching ohne Berücksichtigung der Groß- und Kleinschreibung.
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
update table set tag = LOWER(tag)
Version für Matching ohne Berücksichtigung der Groß- und Kleinschreibung und mit einer "WHERE" -Klausel, wenn Sie nicht die gesamte Spalte aktualisieren möchten:
UPDATE table
SET tag = LOWER(tag)
WHERE LOWER(tag) != tag
COLLATE Latin1_General_CS_AS
Die COLLATE-Zeile funktioniert, wenn in Ihrer Datenbank die Übereinstimmung zwischen Groß- und Kleinschreibung nicht berücksichtigt wird, wie in meiner.
Versuche dies:
update `table` set `column_name` = LOWER(column_name without quotation)