[] ---- MySQL database query MySql when the property value of a column splicing

The value of a column in the database

Use IN query is unable to locate the data can only be queried IN (2) or IN (2,3) 

search result:

SELECT * FROM t_table WHERE FIND_IN_SET(2, style_id)

 

Proper way: Use FIND_IN_SET function

SELECT * FROM t_product WHERE (FIND_IN_SET(2, style_id) OR FIND_IN_SET(3, style_id))

 search result

 

Guess you like

Origin blog.csdn.net/ningjiebing/article/details/89411025