I have a list of items which contain:
The link below references my SQLFiddle Example. I want to get the availability periods of each product for a given period, e.g:
List the availability periods for the period [2018-11-01, 2018-11-30] of the prod_id = 10.
It will display:
1. [2018-11-01, 2018-11-01] 2. [2018-11-03, 2018-11-03] 3. [2018-11-06, 2018-11-07] 4. [2018-11-10, 2018-11-31]
The operator difference of
daterange does not support this type of differences and it returns :
ERROR: result of range difference would not be contiguous
I realized that it is not possible to get the suitable results using the operator with such data.Is there any link or another solution to select the products in this way?