×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Grouping by the customer id and line type should do this. Something
along the lines of:

  SELECT cust_id, line_type, sum(amount)
    FROM billing_file
GROUP BY cust_id, line_type
ORDER BY cust_id, line_type

For performance reasons, you'll want to create a logical file that has
the fields used by your selection criteria followed by the fields used
in the ORDER BY clause.

Matt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Douglas W. Palme
Sent: Monday, November 14, 2005 9:50 AM
To: RPG Group
Subject: SQL within RPG

I have a program that calculates sales for each of our customers based
upon 
the type of sale it is (defined by a line type), it is using embedded
sql 
and works fine.  What I would like to do is expand it so that I can
display 
for each customer within the subfile their totals sales for two or
possibly 
three seperate line types IE: line haul charges, stop off charges, fuel 
surcharges.

Is there a way to do this without having to create a work file or re-run
the 
sql query for each line type? What I mean is this, is it possible to
select 
the sums for each of sales for each line type grouped by customer?


If you bought it, it was hauled by a truck - somewhere, sometime.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.