MySQL Like for Postcodes
Trying to load mySQL information for postcode matching. The first two queries work but sometimes users dont place spaces between them… what is the solution please? I tried LIKE for a turn around as I thought it was most logical
SELECT * FROM tblAccounts WHERE Email=‘john.smith@domain.com’ AND Postcode LIKE ‘m1 3tg’
Works
SELECT * FROM tblAccounts WHERE Email=‘john.smith@domain.com’ AND Postcode LIKE ‘M1 3TG’
Works
SELECT * FROM tblAccounts WHERE Email=‘john.smith@domain.com’ AND Postcode LIKE ‘m13tg’
Fail no rows returned
SELECT * FROM tblAccounts WHERE Email=‘john.smith@domain.com’ AND Postcode LIKE ‘M13TG’
Fail no rows returned
The mySQL Table
DevRID Email Postcode
1 john.smith@domain.com M1 3TG