Rama Lingam Rama Lingam - 1 year ago 91
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

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download