How can I find out how long the value of a column is. Something like:
SELECT * FROM `tablename` WHERE `field`.length > 20
I know that this statement is wrong. I just don’t know how to phrase it. I can’t seem to find any documentation on the matter.
So I need to select all rows from a table that the phone field has more than 20 characters.
I imported a file and my customer merged 2 phones numbers in 1 fields, so I need to get all thoses affected rows to fix them.
Thanks for the help.
You can use the
length()function to determine how many characters the field has in it.If you think you will have whitespace, then you can combine it with
TRIM():