Re: How do I..... (PL/SQL ?) newbie question.

From: Ted Goulden <gouldent_at_cadvision.com>
Date: 1996/08/14
Message-ID: <4urig5$447c_at_elmo.cadvision.com>#1/1


A simple GROUP BY clause will do what you want to do just fine.

SELECT CUST#, SUM(GROSS_REVENUE)
FROM CUST_DATA_TABLE
GROUP BY CUST#; skell_at_binc.net (Steven Kell) wrote:

>I have a base table for sales data that has fields for cust#, cust_location#,
>(some customers have multiple locations, but the same cust# for all
>locations) quarter, year, and gross_revenue. So, a row looks like this:
 

>CUST# CUST_LOCATION# QTR YEAR GROSS_REVENUE
>1 1 1 1995 3500
>1 2 1 1995 450
>2 1 1 1995 5600
>2 1 2 1994 4400
>1 1 3 1994 42000
>etc.....
 

>How can I find the total gross revenue for each cust#, regardless of what
>the cust_location#, qtr or year are? I want a sum total of gross_rev for
>cust# 1, cust# 2 for all quarters in all years.
 

>Any suggestions would be appreciated.
 

>P.S. I'm using Oracle Workgroup Server V 7.1.3.3.1 on Novell Netware.
 

>Thanks!!
Received on Wed Aug 14 1996 - 00:00:00 CEST

Original text of this message