view raw
Rama Lingam Rama Lingam - 6 months ago 35
MySQL Question

MYSQl - Check if group of dates are in a comma separated list of dates

My table design:

enter image description here

How to get the records If dates '04-11-2016' OR '11-11-2016' available in


Note: The dates are not same, It's have one or more dates.

Actual Query:

SELECT * FROM `sh_products` WHERE FIND_IN_SET('04-11-2016','11-11-2016',week_days);

Expecting Result:

enter image description here


Just OR together two calls to FIND_IN_SET:

FROM sh_products
WHERE FIND_IN_SET('04-11-2016', week_days) > 0 OR
      FIND_IN_SET('11-11-2016', week_days) > 0