Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
when I write this query

SELECT * FROM mytable WHERE username = "JohnBobJones"

how can I find this type of result

John Bob Jones
JohnBob Jones
JohnBobJones
JohnBob-Jones
Posted
Comments
Zoltán Zörgő 5-Sep-15 4:09am    
Don't ask the same question multiple times - even reformulated!

1 solution

One way is to remove the blanks from the data using REPLACE. For example:
SQL
SELECT * FROM mytable WHERE REPLACE(username, ' ', '') = "JohnBobJones" 

The same can be done for other characters so if you also want to remove the hyphen then
SQL
SELECT * FROM mytable WHERE REPLACE( REPLACE(username, ' ', ''), '-', '') = "JohnBobJones" 
 
Share this answer
 
v2
Comments
hareshdgr8 5-Sep-15 4:07am    
sorry didn't work sir please check it.
hareshdgr8 5-Sep-15 4:09am    
sir my mistake thank you so much .......
Wendelius 5-Sep-15 4:24am    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900