have start and end dates:
oa.entity_created oa.lagg
id 1| start |2022-07-20 end |2022-08-15
id 2| start |2022-06-15 end |2022-08-09
id 3| start |2022-08-12 end |blank
How to count between this dates without start date and end date, like this
oa.entity_created oa.lagg
id 1| start |2022-07-21 end |2022-08-14
id 2| start |2022-06-16 end |2022-08-08
id 3| start |2022-08-13 end |blank
If blank count until current_date
count(case when (oa.entity_created < cred.entity_created and oa.lagg > cred.entity_created) then 1 end)
doesn't work correctly