Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Request for proper SQL

Request for proper SQL

From: <mathaijx_at_aramco.com.sa>
Date: Tue, 08 Jun 1999 12:41:50 GMT
Message-ID: <7jj32d$jo8$1@nnrp1.deja.com>


Table1 is the master table having account codes.

Table2 is the detail table with both the columns as the FK to Table1 having a account codes and sub-account codes.

Table3 is the transaction table with values against each Account code

I want a SQL statement to produce the result mentioned.

Table1
AcNo
A
B
X
Y
Z

Table2

AcNo 	SubAcNo
X	A
X	B


Table 3
AcNo	Value
A	200
B	150
X	100
Y	300
Z	350


Required Result
X	450
Y	300
Z	350


Result of X is ( 200 + 100 + 150)

Thanks in Advance

John

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Jun 08 1999 - 07:41:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US