|
I
receintly had to come up with this solution, but I needed the # of business days
in a view. I can't take credit for this, someone else came up with the
solution, but this is what you do. The syntex is going to vary a little
depending on your database, but this should work in any database that supports
sub selects.
my_table - table I want to compute the business day
from
date1
date
date2
date
non_bus_days - 1 record for every saturday, sunday and
holiday.
nbd_date date
to get
the business days between date1 and date2, do the following.
select
date1, date2, (date2 - date1) as num_days, (date2 - date1 - (select count * from
non_bus_days where ndb_date between date1 and date2)) as num_bus_days from
my_table
Troy
Sosamon
________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf |
- Witango-Talk: weekdays Trevor Green
- RE: Witango-Talk: weekdays Troy Sosamon
- RE: Witango-Talk: weekdays Ben Johansen
