MYSQL - query the database where & is in the cell

I have a table with items in my MySQL database.

I am trying to query a string containing "&". The column is a text value and contains the content "TV and Stands".

SELECT * FROM  `items` WHERE  `name` =  'TV & Stands' LIMIT 0 , 30

This returns 0 results, although TV and Racks are clearly in the name column. If I ask for the name of the element without the "&" character, it returns the correct value.

How can I request this data correctly?

+4
source share
2 answers

=, , . , / , . LIKE instate.

SELECT * FROM  `items` WHERE  `name` LIKE '%TV & Stands%'
+4

, . , like:

SELECT *
FROM `items`
WHERE `name` LIKE 'TV _ Stands'
LIMIT 0 , 30;
+2

Source: https://habr.com/ru/post/1614985/


All Articles