MYSQL - searching for some strings

CHC :

I have a table with lots of features, but I used features as just one column.

tbl_shop

id     |     name        |    feature

I used php implode to save the data to feature, and it will show like this

id     |     name        |    feature
1      |    shop_1       |   wifi,smarttv,cr

When I use LIKE to search for the data I can actually get the shop properly if I just search for one feature like wifi

the thing is if i tried to search for wifi,smarttv or smarttv,cr there is no problem, but when I tried to search wifi,cr that time it would not find the shop, is there any way of searching data like this in MySQL ?

Gro :

You can insert a % in between your shops (or partial shops)

select * from table where feature like '%wifi%cr%';

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=27848&siteId=1