Find specific value in comma list in database

前端 未结 2 469
傲寒
傲寒 2021-01-28 20:04

In one of my tables, i have a column where it has a comma seperated list of users that have bought that item. IMAGE

How can i read the list and run a php script to find

2条回答
  •  佛祖请我去吃肉
    2021-01-28 20:43

    Use FIND_IN_SET() to find the records that contain your user

    select *
    from your_table
    where find_in_set('MTNOfficial', usersBought) > 0
    

提交回复
热议问题