1
How to run a SELECT SQL that only looks for VARCHAR type results that contain only one word? That is, I don’t want results with more than one word
1
How to run a SELECT SQL that only looks for VARCHAR type results that contain only one word? That is, I don’t want results with more than one word
Browser other questions tagged mysql sql query
You are not signed in. Login or sign up in order to post.
How to ask a good question? Go to https://answall.com/help/how-to-ask
– ElvisP
Suppose when the field has more than one word they are separated by space then use NOT LIKE '% %'.
– anonimo
Geniiaaal of space, I hadn’t thought of that!
– Christian Jorge
With some functions it is possible to check: CHARACTER_LENGTH(Your column) the 'numcharacters', SUBSTRING_INDEX(SUBSTRING_INDEX(Your column, ', ', 1), ', -1) AS primeironome ,TRIM( SUBSTR(Suacoluna, LOCATE(' ', Suacoluna)) AS last name, if(TRIM( SUBSTR(Your column, LOCATE(' ', Your column)) = '','CONTAINS FIRST','HAS SECOND NAME') THE CHECKS
– Edvaldo Lucena