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

From: Atul S. Parasnis <apara_at_ctp.com>
Date: 1996/08/12
Message-ID: <320F8ECB.38AD_at_ctp.com>#1/1


Try:

'select cust#, sum(gross_revenue) total_gross_revenue from sales_data
group by cust#'

If your want it by year then try:
'select cust#, year, sum(gross_revenue) total_gross_revenue from sales_data
group by cust#, year'

  • Atul

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!!
 

-- 
Atul S. Parasnis
Received on Mon Aug 12 1996 - 00:00:00 CEST

Original text of this message