Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Complicated SQL
Jack C. Holt wrote:
> I have a database that contains diskspace needed for for various
> projects with start and stop date fields. I want to create one SQL
> statement that will return the sum of diskspace used by month for the
> next year.
>
> Can SQL do this and can you write me an example statement?
It will be similar to the following:
select sum(diskspace)
from tablename
group by to_char(startdate, 'mmyyyy')
I assume your startdate and the stopdate lie on the same month and the same year. Otherwise, you cannot determine how much proportion of the diskspace used.
--- Name : Lun Wing San Title : Oracle Application Developer of Hong Kong Productivity Council Oracle Database Administrator and System Administrator of QRC Phone : (852)27885841 This posting represents the personal opinions of the author. It is not the official opinion or policy of the author's employer. Warranty expired when you opened this article and I will not be responsible for its contents or use.Received on Fri Feb 14 1997 - 00:00:00 CST