Home » SQL & PL/SQL » SQL & PL/SQL » Need help in writing query (merged)
Need help in writing query (merged) [message #359347] Sat, 15 November 2008 01:41 Go to next message
ar.forums
Messages: 7
Registered: June 2008
Location: Saudi Arabia
Junior Member
I have the following level accounts

10000
11000
11100
11101
..
..
11200
11201
..
..
..
12000
12100
..
..
..
12101
12102
12103
..
..
..
20000
21000
21100
21101
..
..
22000
22101
..
..
..
.
21200
21201
..
..

I have to take the amount of the child account and sum it to the parent account as below:

11100 = 11101 + 11102 - 11103+.........

11000 = 11100 + 11200 + 11300+.........

10000 = 11000 + 12000 + 13000+.........



21100 = 21101 + 21102 - 21103+.........

21000 = 21100 + 21200 + 21300+.........

20000 = 21000 + 22000 + 23000+.........

Please help...

Thanks in advance.
Re: Need help in writing query [message #359349 is a reply to message #359347] Sat, 15 November 2008 01:50 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Post a test case: create table and insert statements along with the result you want with these data.
Explain in DETAILS and with words what are the requirements.
This:
20000 = 21000 + 22000 + 23000+.........
is at least meaningless, even a child knows it is wrong.

Post what you already tried.

Regards
Michel

[Updated on: Sat, 15 November 2008 01:55]

Report message to a moderator

Previous Topic: Indexing
Next Topic: To Get dependent data from table
Goto Forum:
  


Current Time: Sun Dec 04 04:58:32 CST 2016

Total time taken to generate the page: 0.19045 seconds