Say my table is this
validity table
id | validity_dates
-------------+-------------------------
1 | [2018-01-01,2019-01-01)
2 | [2017-05-01,2017-06-01)
3 | [2016-05-01,2016-07-01)
4 | [2022-01-01,2025-01-01)
5 | [2022-01-01,2025-12-10)
How do I query to get the id
based on whether the date range between validity_dates still exists within today and the future.
For example I want to get id's
that are still valid from today and future. I run a query and get a return on id 4
and 5
since the validity dates ends in 2025.
My current implementation doesn't work in the sense it doesn't provide the right output.
SELECT id
FROM validity
WHERE validity.validity_dates = DATERANGE('2023-01-09','2025-01-09', '[]')
How best do I approach this?