-3

I have a column in mysql table PACKAGES as SERVICE_EXPIRY_DATE which holds a date time value.

Now I want to match only those records whose SERVICE_EXPIRY_DATE is coming within the next 15 days from the moment of querying.

How can I match those columns.

User 101
  • 1,351
  • 3
  • 12
  • 18

1 Answers1

2

You could do it by using intervals

WHERE `SERVICE_EXPIRY_DATE` BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 15 DAY)

Look at MySql documentation for more reference https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
finnishNinja
  • 91
  • 1
  • 5