mysql去除查询字段的空格

219 阅读1分钟

因为mysql查询的时候精确到空格,所以,想要去去除中间的空格除了用正则以外,mysql写法:

select * from cityall where trim(replace(cityEn,' ','')) = trim(replace('San Fra nc i s c o',' ','')) 
and  trim(replace(countryEn,' ','')) = trim(replace('UnitedStates',' ',''));

在这里插入图片描述