1

Inside my database table called Postcodes I have rows like AB10 1AB, AB10 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?

in brief, I want to access a row inside a database which has a value of AB10 1AB using AB101AB

something like

SELECT 
    * 
FROM 
    `Postcodes` 
WHERE 
    `postcode` = REMOVEWHITESPACES FROM `postcode` ROW('AB101AB')
eLRuLL
  • 18,488
  • 9
  • 73
  • 99
Curtis
  • 2,646
  • 6
  • 29
  • 53
  • possible duplicate of [MySQL - how to remove white space in a mysql field](http://stackoverflow.com/questions/6858143/mysql-how-to-remove-white-space-in-a-mysql-field) – ChrisW Sep 24 '13 at 23:09

1 Answers1

1

Use the replace() function (reference here):

select *
from `Postcodes`
where replace(`postcode`, ' ', '') = 'AB101AB'
Barranka
  • 20,547
  • 13
  • 65
  • 83