Reputation: 352
I have a field name "value" which contains 4 digits, 8 digits and 16 digits. How do I get only the four digits using mysql statement "SELECT" with where condition?
Here are the example.
value
1001 90812323 8928123458341235 0123 4521 84920192 7584
Getting only the "1001,0123,4521 and 7584".
Is this possible?
Upvotes: 1
Views: 1405
Reputation: 56
SELECT * FROM tb WHERE char_length(value) = 4
check this link: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
Upvotes: 2