Archives of the TeradataForum
Message Posted: Tue, 14 Jan 2003 @ 23:21:09 GMT
Subj: | | Re: History table monthend logic |
|
From: | | krishnan |
This is based on my understanding of the problem.
The view can be something like
select extract(month from calendar_date-1)||'/'||extract (year from
calendar_date-1) as month_ending,
accnt,plan_code
from hst_tbl a,
sys_calendar.calendar b
where b.calendar_date > a.plan_start_dt
and b.calendar_date <= a.plan_stop_dt
and b.day_of_month=1
and b.calendar_date > '1990-01-01' and b.calendar_date <= date
order by accnt,calendar_date
P.S. where '1990-01-01' can be a date which is set based on the reporting year.
|