Searching a column containing CSV data in a MySQL table for existence of input values

前端 未结 5 519
无人及你
无人及你 2020-12-19 16:53

I have a table say, ITEM, in MySQL that stores data as follows:

ID    FEATURES
--------------------
1     AB,CD,EF,XY
2     PQ,AC,A3,B3
3     AB,CDE
4     AB         


        
5条回答
  •  醉梦人生
    2020-12-19 17:32

    Alternatively, consider using RLIKE()

        select * 
          from ITEM
         where ','+FEATURES+',' RLIKE ',AB,|,PQ,'; 
    

提交回复
热议问题