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

From: Venkateswara R Polisetti <vrao_at_sctcorp.com>
Date: 1996/08/12
Message-ID: <1996Aug12.105028.8476_at_mcrcr6>#1/1


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?

SELECT CUST#, SUM(GROSS_REVENUE)
FROM SALES_DATA
GROUP BY CUST#;
> I want a sum total of gross_rev for
>cust# 1, cust# 2 for all quarters in all years.

SELECT CUST#, SUM(GROSS_REVENUE)
FROM SALES_DATA
WHERE CUST# IN (1,2)
GROUP BY CUST#;
>Any suggestions would be appreciated.
 

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

>Thanks!!

Venkateswara Rao. Received on Mon Aug 12 1996 - 00:00:00 CEST

Original text of this message