The following query selects rows where the date_field is a particular month and day:
Table.where("DATE_FORMAT(date_field, '%m/%d') = ?", "03/05")
I was wondering if there is a way to do something similar but instead, I supply a list of month/day strings ex: ["03/05","02,12", "12/25"] and get all rows where date_field matches that particular day and month.
CodePudding user response:
You can use a SQL IN statement:
Table.where("DATE_FORMAT(date_field, '%m/%d') IN ?", ["03/05", "02/12", "12/25"])
