min2bro
min2bro

Reputation: 4628

Select Statement result with space and without space

Is there a way in MYSQL to search for all the records with spaces and without spaces and also by flipping the strings

Example:

Search String: JM Edward

Expected Result:

J M Edward
JM Edward
J MEdward
Edward J M
Edward JM

Upvotes: 0

Views: 442

Answers (2)

user9946933
user9946933

Reputation:

Would this work for what your search? It would return all of the results.

SELECT * FROM Names
WHERE Names LIKE '%J%' and Names LIKE '%M%' and Names LIKE '%Edward%'

Upvotes: 1

Mohammedis271
Mohammedis271

Reputation: 185

Yes there is, so your sql statement would look something similar to these

Select * from table like %J% Which will show all results with the letter J in it and for space you would do it like so: Select * from table % % Add a space in between

Upvotes: 0

Related Questions