Link to home
Start Free TrialLog in
Avatar of Beverly Penney
Beverly PenneyFlag for Canada

asked on

Case statement using dates

I have the following case statement in a query however it is bringing back the incorrect values,  everything is showing up in the result set as 'Greater than 61 days' however there is a range of dates that should be falling into the various categories.


  case (when  trunc(creation_date)  between trunc(sysdate) and trunc(sysdate - 7) then '7 Days'
              when  trunc(creation_date) between trunc(sysdate -8) and trunc(sysdate -31) then '8-30 Days'
              when  trunc(creation_date)  between trunc(sysdate -32) and trunc(sysdate -61) then '30 - 60 Days'
              else 'Greater 61 Days') end as Aging
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial