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:[EMAIL PROTECTED] > Sent: Monday, March 10, 2003 9:41 AM > To: [EMAIL PROTECTED] > 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 [EMAIL PROTECTED]