简体   繁体   English

删除查询mySQL上的空格

[英]remove whitespaces on query mySQL

Inside my database table called Postcodes I have rows like AB10 1AB , AB10 2AB 在我的名为Postcodes数据库表中,我有AB10 1ABAB10 2AB

so when I'm pulling them to access a dynamic page they're appearing in the URL like AB10%201AB obviously because or being URL encoded, now how can I set the URL to just AB101AB and then still access the database row using AB101AB ? 因此,当我拉动它们访问动态页面时,它们显然出现在AB10%201AB URL中, AB10%201AB显然是因为或已进行了URL编码,现在如何将URL设置为AB101AB ,然后仍然使用AB101AB访问数据库行?

in brief, I want to access a row inside a database which has a value of AB10 1AB using AB101AB 简而言之,我想使用AB101AB访问值为AB10 1AB的数据库中的AB101AB

something like 就像是

SELECT 
    * 
FROM 
    `Postcodes` 
WHERE 
    `postcode` = REMOVEWHITESPACES FROM `postcode` ROW('AB101AB')

Use the replace() function (reference here ): 使用replace()函数( 在此处参考):

select *
from `Postcodes`
where replace(`postcode`, ' ', '') = 'AB101AB'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM