Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Anyone help me with this?

Re: Anyone help me with this?

From: Daniel A. Morgan <Daniel.Morgan_at_attws.com>
Date: Fri, 13 Jul 2001 08:43:33 -0700
Message-ID: <3B4F1725.DD819F05@attws.com>

Andy wrote:

> Is there anyway to make this sql do the following
> using the truncate function in Oracle 8 and then get the count to work by
> formatting the date?
>
> SELECT TRUNC(PLAN_S_DATE) as CallDate, Count(PLAN_S_DATE) AS TotalCalls
> FROM IFSAPP.ACTIVE_SEPARATE
> WHERE (((ORG_CODE='613')
> OR (ORG_CODE='614')
> OR (ORG_CODE='618')))
> GROUP BY TRUNC(PLAN_S_DATE)
> HAVING TRUNC(PLAN_S_DATE) BETWEEN TO_DATE('&From_Date_MMDDYY','MMDDYY')
> AND TO_DATE('&To_Date_MMDDYY','MMDDYY')
>
> Current Output
> Date Totalcalls
> 2001-05-22-00.00.00 1
> 2001-05-23-00.00.00 1
> 2001-05-29-00.00.00 1
> 2001-06-01-00.00.00 2
> 2001-06-04-00.00.00 2
> 2001-06-05-00.00.00 1
> 2001-06-12-00.00.00 1
> 2001-06-19-00.00.00 3
>
> Desired Output
>
> Date Totalcalls
> 05-22-2001 1
> 05-23-2001 1
> 05-29-2001 1
> 06-01-2001 2
> 06-04-2001 2
> 06-05-2001 1
> 06-12-2001 1
> 06-19-2001 3

Forget TRUNC ... use TO_CHAR with the format you wish to display.

Daniel A. Morgan Received on Fri Jul 13 2001 - 10:43:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US