Reputation: 241
I have the below date column in a table.
TableA
WEEKENDDATE
2/24/2019
3/10/2019
6/10/2019
How do I only return results from less than two Sundays ago using the where clause?
So, any date from column WEEKENDDATE that is greater than two Sundays ago would NOT show.
select * from TableA where 1=1 --and
Upvotes: 0
Views: 54
Reputation: 1269873
I think you want:
where weekenddate >= next_day(sysdate - interval '1' day, 'SUNDAY') - interval '14' day
(I'm not sure if you want 2 or three weeks in the past.)
That said, your dates all appear to be on Sundays, so this seems simpler:
where weekenddate >= trunc(sysdate) - interval '14' day
Upvotes: 1