ADSM-L

Re: Select statement using last month's summary

2003-03-10 11:51:58
Subject: Re: Select statement using last month's summary
From: "Coats, Jack" <Jack.Coats AT BANKSTERLING DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Mon, 10 Mar 2003 10:50:19 -0600
        Ok, this is my guess. ...
         /*                                              */
        select case when SUM(BYTES) IS NOT NULL then CAST(SUM(BYTES) AS -
        DEC(40,2))/(1024*1024*1024) else ABS(CAST((0) AS -
        DEC(40,2))) end AS "Total Gigabytes" from summary -
        where MONTH(end_time)=MONTH(CURRENT DATE)-1 -
        and YEAR(end_time)=YEAR(CURRENT DATE)

Let us know if it works for you.
I also think it would break when running it in January for Decembers data.

Running "select * from summary" I noticed the end_time does not go back for
all of last month (I am
running it on March 10, and the oldest I found was for February 8.

> -----Original Message-----
> From: Shannon Bach [SMTP:SBach AT MGE DOT COM]
> Sent: Monday, March 10, 2003 9:41 AM
> To:   ADSM-L AT VM.MARIST DOT EDU
> Subject:      Select statement using last month's summary
>
> The following select was pulled from this list;
> /*                                              */
> select case when SUM(BYTES) IS NOT NULL then CAST(SUM(BYTES) AS -
> DEC(40,2))/(1024*1024*1024) else ABS(CAST((0) AS -
> DEC(40,2))) end AS "Total Gigabytes" from summary -
> where DAY(end_time) = DAY(CURRENT DATE)-1 -
> and MONTH(end_time)=MONTH(CURRENT DATE) -
> and YEAR(end_time)=YEAR(CURRENT DATE)
>
> If I wanted to get this same information, but for last month, does anyone
> how I could do this?
> I tried a few variations but could not get it to work.  Any ideas?
>
> Shannon Bach
> e-mail sbach AT mge DOT com

<Prev in Thread] Current Thread [Next in Thread>