Gal Gal - 1 year ago 161
MySQL Question

MySQL - How to select data by string length

SELECT * FROM table ORDER BY string_length(column);

Is there a MySQL function to do this (of course instead of

hsz hsz
Answer Source

You are looking for CHAR_LENGTH() to get the number of characters in a string.

For multi-byte charsets LENGTH() will give you the number of bytes the string occupies, while CHAR_LENGTH() will return the number of characters.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download