Search code examples
mysqlperiod

multiple date periods


In my MySQL DB I've got one table storing date periods. Each period row has PSTART and PEND columns defining period start and period end dates. How to create a query which will check if one particular date is within any of these periods or not? Number of periods in not fixed!


Solution

  • SELECT * FROM periods WHERE [a date] BETWEEN PSTART AND PEND