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

前端 未结 5 544
无人及你
无人及你 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条回答
  •  猫巷女王i
    2020-12-19 17:32

    Just a thought:

    Does it have to be done in SQL? This is the kind of thing you might normally expect to write in PHP or Python or whatever language you're using to interface with the database.

    This approach means you can build your query string using whatever complex logic you need and then just submit a vanilla SQL query, rather than trying to build a procedure in SQL.

    Ben

提交回复
热议问题