1

Table page:

| id | page_title |

| 1 | John_Lennon |

Select:

SELECT * FROM page WHERE LOWER(page_title) = 'john_lennon';

I want to have the row with page_title = 'John_Lennon'. I don't know why, but it does not work. In phpmyadmin it returns null.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Name
  • 139
  • 2
  • 9

1 Answers1

1

There could be extra spaces present in that column data and so it's not matching. Try using TRIM() function as well along with LOWER() like

SELECT * FROM page WHERE TRIM(LOWER(page_title)) = 'john_lennon';
Rahul
  • 76,197
  • 13
  • 71
  • 125
  • It returns also null :/ – Name Jun 04 '15 at 18:25
  • 1
    Can you post you table schema/definition? looks like a problem with `collation` – Rahul Jun 04 '15 at 18:27
  • LOWER() might not do what you expect against a VARBINARY column, see: http://stackoverflow.com/questions/6807839/mysql-case-insensitive-search-on-varbinary-field – chsh Jun 04 '15 at 19:57