Q:

How can I write a query with unwated spaces in my text?

I am currently improving the search functionality of my cms so that users can search for entries by copying and pasting text from a web page and finding it in the database.
The query is simple. It takes the search term and does a LIKE '% text here %' query.
The problem is, I'm not getting many results and have figured out why.
In the CMS itself, a lot of the text that has been entered from MS Word seems to be double spaced. Such as 
"Hello my  name  is James"

However on the front end website it renders properly, with single spaces, like:
"Hello my name is James"

This means my query is never picking up the database entry based on what is shown on the web page.
Any suggestions? Do I tackle the double spaces in the CMS (seems risky to me with so much HTML in there!), or can I adjust my query to cope with it?

A:

if it is only double spaces that are creating the issue, then just
replace(columnToSearch,'  ',' ') 

when searching, or as @ManMohan suggests, before inserting the data into your table in the first place

