Home » SQL & PL/SQL » SQL & PL/SQL » from sysdate
from sysdate [message #1904] Sun, 09 June 2002 22:51 Go to next message
Robin
Messages: 73
Registered: October 2001
Member
i am trying to get a report that shows tickets that
are open between 5 & 30 days, then between 31 &
60 days, then between 61 & 90 days.

My query

select ticket, datecreate from table
where status = 'Open' and
trunc (datecreate) <= (sysdate -5)
and trunc (datecreate) >= (sysdate -30)

I cannot figure out how to get the 31-60 and the 61
to 90 day into the same query.
I am a real newbie
Help Please
Re: from sysdate [message #1905 is a reply to message #1904] Mon, 10 June 2002 01:18 Go to previous message
JoJo
Messages: 18
Registered: January 2002
Junior Member
try with a union like :
select ticket, datecreate from table
where status = 'Open' and
trunc (datecreate) between (sysdate -30) and(sysdate -5)
UNION
select ticket, datecreate from table
where status = 'Open' and
trunc (datecreate) between (sysdate -31) and (sysdate -60)
UNION
select......
Previous Topic: question
Next Topic: can use a SQL dynamic in a CURSOR ?
Goto Forum:
  


Current Time: Fri Apr 19 21:40:16 CDT 2024