Trying to run the same view with different date filters depending on which day I'm running it. If I run the query on a Fri, Sat, Sun, or Mon then the dates should be filtered on Tues-Thurs. If I run the query on Tues, Wed, Thurs then the dates should be filtered on Fri-Mon. Those are the only two scenarios. I'm using PostgreSQL.
The view itself is pretty simple otherwise:
select * from tbl_1
where date between ____ and _____
I do have a dates table that I can join to. I've tried something like:
(select date
,case when day_of_week_iso IN(2, 3, 4) THEN 1 ElSE 4 END as "day"
from tbl.date
where date = current_date
) dates