0

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?

OldProgrammer
  • 12,050
  • 4
  • 24
  • 45
user979331
  • 11,039
  • 73
  • 223
  • 418

3 Answers3

5

Try this:

 WHERE REPLACE(cc.community,' ','') = 'Downtown' 
nacho
  • 5,280
  • 2
  • 25
  • 34
1

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.

9000
  • 39,899
  • 9
  • 66
  • 104
0
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"

Gabri T
  • 454
  • 2
  • 13