-3

I have a table in database that is TEXT field. In this table i have stored my product ids . Now when i go to cart and get all product id of cart i want to match from database field and get only those ids that there stored in product id.

Please see image first.

In this field you will see "check_values" field. here all product ids are stored in comma separated.

Let me take a example

Like i have purchase a product that product id is 161. So i want to match 161 id from "check_value" filed and get only those ids (from images) that having 161.(11,14,15).

Hope you understand my question.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Pritesh Mahajan
  • 4,974
  • 8
  • 39
  • 64

1 Answers1

3

You can use FIND_IN_SET e.g.

SELECT * FROM images WHERE FIND_IN_SET(161, check_values) > 0

rjdown
  • 9,162
  • 3
  • 32
  • 45