I have this where clause:
WHERE cc.community = 'Downtown'
but in my database there is no community called Downtown, but Down town. My question is can I remove the whitespace from the cc.community in my where clause its where Downtown = Downtown?
I have this where clause:
WHERE cc.community = 'Downtown'
but in my database there is no community called Downtown, but Down town. My question is can I remove the whitespace from the cc.community in my where clause its where Downtown = Downtown?
Try this:
WHERE REPLACE(cc.community,' ','') = 'Downtown'
You can use something like
WHERE cc.community LIKE `Down%town`
The above should match both Downtown
and Down town
, but also things like Down_town
or DownANYTHINGELSEtown
. More precise matching is possible.
It will likely affect performance if your plan uses an index by the community
field; check your query plan.
update table set cc.community = 'Downtown' where cc.community like '%Down%town%'
this will change every row where there is the word Down and then town even if it is 42Down123town232
you can also change your "WHERE" clause to :
WHERE cc.community like 'Down%town'
and it will work for both cases,but carefull...
it will also accept per example "Down_town" or "Down the town"