Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date

422368Sep 16 2006 — edited Sep 16 2006
Hello,

I have the following query which returns dates till this month from January 2005.
I need to have one condition where current month should display only when dates becomes 25th else results should display only till last month.
:Eg: Right now it is Jan-2005 till Sep 2006. What I wanted is if date is less than 25 then display till Aug 2006 else display till Sep 2006.

How can I acheive this?
** SQL**
select distinct to_char(period_name,'Mon-YYYY') period_name from dt
where period_name >= to_date('01/01/2005','DD/MM/YYYY') and period_name <= trunc(sysdate)
--and period_name
order by to_date(period_name,'MON-YY') desc
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 14 2006
Added on Sep 16 2006
8 comments
365 views