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

Home -> Community -> Usenet -> c.d.o.server -> Re: subtotaling by weekly

Re: subtotaling by weekly

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 1 Mar 2006 11:30:47 -0800
Message-ID: <1141241447.875263.182780@z34g2000cwc.googlegroups.com>


You should probably use a date column for date information. With a single date column you can use to_char to extract data by day of the week, Month, year, or any other piece of information contained in a date column (date + time).

To sum data by a column value you normally use the GROUP BY clause. See the SQL manual. Image a table with a row for each paycheck an employee received for the last year.

select employee, sum(paycheck_amount)
from employee_pay_records
group by employee

The query would produce one row per employee with the total of all their paychecks.

You can use multiple aggregate functions: min, max, sum, avg in a single pass.

HTH -- Mark D Powell -- Received on Wed Mar 01 2006 - 13:30:47 CST

Original text of this message

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