Re: How to manipulate data from two data blocks? URGENT!

From: Romeo A. Ybanez <raybanez_at_pworld.net.ph>
Date: Thu, 17 Dec 1998 19:25:08 +0800
Message-ID: <75ap7n$eoc$1_at_news.mozcom.com>


You can try ,

"select account_no, sum(amount) from expense_table group by account_no having sum(amount) > 10;"

You can join the customer_table if you want to display the account_name of each account_no.

I hope it helps.

suisum_at_ecn.ab.ca wrote in message <3676ecb5.0_at_ecn.ab.ca>...
>Hi Jochen:
>
>Thank you very much for your info.
>
>Now I create a procedure to join several tables and eliminate records
>during processing. But the performance is slow as SUM, MAX commands.
>
>The problem is:
>
>I have to get the sum of a column. Based on the sum, it'll decide whether
>to display the record in the canvas.
>e.g.
>
>Customer_Table
>--------------
>
>Account_no Account_name
>---------- ------------
> 1 ABC
> 2 BBC
> 3 CCC
>
>Expense_Table
>-------------
>
>Account_no expense_code Amount
>---------- ------------ ------
> 1 1 20
> 1 2 30
> 2 3 40
> 2 1 5
> 3 1 5
>
>
>I need to show:
>
> The sum of the amount is greater 10. So in my case, the record CCC
> should not be shown on the screen as there is no expense amount.
> Also, I need to call other procedures to calculate the actual expenses
>total.
>
>
>
>
>
>Jochen Van den Bossche (Jochen.Van-Den-Bossche_at_eurocontrol.be) wrote:
>: suisum_at_ecn.ab.ca wrote:
>: >
>: > Hi all:
>: >
>: > I'm using form 4.5.
>: >
>: > I need to retrieve records in the following manner:
>: >
>: > 1. First pass. Retrieve all records from a table which do not exist in
>: > other table.
>: >
>: > 2. Second pass. Only pick those records with the following conditions:
>: >
>: > . the tran_date in table A is less than the query date
>: > entered by the user.
>: >
>: > OR
>: > --
>: > . the sum of table B + the sum of the table C
>: > is greater that the query amount entered by the user.
>: >
>: > I have tried several solution, but no success. Such as, I want to
retreive
>: > all records first in a temporary block. Then, loop through the block to
>: > insert data into another block. But Oracle complains taht the block is
>: > empty, I can't create any record in the block.
>: >
>: > Any help?
>: >
>: > --
>: > Best regards,
>
>: Give some examples, including dummy tables and stuff.
>: Maybe we can help you, but we have to understand the problem...
>
>--
>Best regards,
Received on Thu Dec 17 1998 - 12:25:08 CET

Original text of this message