Assuming that you are using reasonably recent versions of SQL Server, MySQL, and PostreSQL, they should all support analytic functions (some will call them window functions) which are relatively recent additions to the SQL standard. If so, something like this should work
I'm not sure if that is what you're trying to achieve, but to count working days you need a range of dates.
IMHO the best way to deal with dates is by using a calendar table. Keep in mine that you need to add holidays and days off to your calendar. You can find a lot of samples googling a bit.
If you don't have/want to use a calendar table, you can take ...
This is the trigger that I ultimately ended up using:
create or replace trigger V202577_DELETE_custom
for each row
objectid = :new.sde_deletes_row_id
If I understood you correctly, then see if this helps:
select created_date from that table
check if it is lower than previous Sunday's 23:59
why? Because I presume that it can't be created in the future
How to find that moment in time? One option is to use NEXT_DAY function which returns the "next" Sunday, but - if you subtract 7 (days) from it, ...