mysql - how to handle white spaces in sql -
i want write sql query fetch students live in specific post code. following query.
select * `students` ss ss.`postcode` 'se4 1na'; now issue in database records saved without white space postcode, se41na , may in lowercase, se41na or se4 1na.
the query gives me different results based on how record saved. there way in can handle this?
using regexp 1 way it. performs case insensitive match default.
select * students ss ss.postcode regexp '^se4[[:space:]]?1na$'; [[:space:]]? matches optional space character.
Comments
Post a Comment