0

I need one help. I need to fetch value from table comparing the comma separated string value which is present inside the column. I am explaining my table below.

db_details

id       comment       day_id     basic_id

 1         Hello         1          1

 2         Razz          1           2

 3        Good           2          1

db_basic:

id      special_id      name

 1       1,2             Ram

 2        2              Rahul

 3       1,3             Rocky

Here I need to fetch value by joining two table. I have only data like this comment=Good and day_id= 2 and special_id=2 . As here I have the special_id are in comma separated string , I need to fetch all value from both table by using the given data means the special_id should be match with comma separated string. I need sql query for this.

1 Answers1

0

=> Mysql compare comma-separated field use "FIND_IN_SET();".

WHERE FIND_IN_SET('2', special_id);
Nimesh Patel
  • 796
  • 1
  • 7
  • 23