Name
Name

Reputation: 139

SQL string does not work -> SQL LOWER

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.

Upvotes: 1

Views: 1511

Answers (1)

Rahul
Rahul

Reputation: 77876

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';

Upvotes: 1

Related Questions