Year to Date flag in Date Dimension

I have a date dimension (date Table) and I want to add two columns to it:  Current YTD and Previous YTD.  This column is a char(1) data type that will store an 'X' when the dates are between the first of the year and the current date for the current YTD.

The previous YTD will be the same dates but in the previous year.  What is the Oracle sql for both of these columns that will be updated daily?
Brian_SutherlandAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tangchunfengCommented:
update mytable
set c1='X'
where to_char(c_date,'YYYY')=to_char(sysdate,'YYYY');

update mytable
set c1= c_date - 365 ;   --  how about 366 ?

update mytable
set c1= add_months( c_date, - 12) ;   --  how about 2012-2-29 ?

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.