Home » SQL & PL/SQL » SQL & PL/SQL » Help to bring Closing Balance from this SQL (Oracle 8.1.7, Windows Server 2003)
Help to bring Closing Balance from this SQL [message #304371] Wed, 05 March 2008 00:30 Go to next message
kumarvk
Messages: 214
Registered: July 2004
Senior Member
Dear Experts,

select material, DTE,
max(in_stk) "IN_STK", max(adj_stk) "ADJ_STK",
max(out_stk) "OUT_STK", min(dlrs) "DLRS/RTN"
from mss_v_besco_oil group by material,dte;

From this I am getting this output is

MTL DTE IN_STK ADJ_STK OUT_STK DLRS/RTN
BESCO 01-Feb-08 800 80 299 0
BESCO 02-Feb-08 0 0 9 0
BESCO 04-Feb-08 0 0 109 0
BESCO 05-Feb-08 0 216 84.5 0
BESCO 11-Feb-08 0 0 82.5 0
BESCO 12-Feb-08 0 0 113.5 0
BESCO 13-Feb-08 0 0 91.5 0
BESCO 14-Feb-08 0 0 147 0
BESCO 20-Feb-08 1600 0 260 -800
BESCO 21-Feb-08 0 0 267.5 0
BESCO 22-Feb-08 0 0 242 0
BESCO 23-Feb-08 0 360 41.5 0
BESCO 25-Feb-08 0 0 251.5 0
BESCO 26-Feb-08 800 0 247 0

I want to get the Opening balance & Closing balance day wise by modifying the script, can you experts help me to get the required output for me.

Re: Help to bring Closing Balance from this SQL [message #304377 is a reply to message #304371] Wed, 05 March 2008 00:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68712
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
It is clearly stated in the forum description: "Newbies should not post to this forum!"
Expert notion is defined in the sticky: Not an EXPERT? Post in the NEWBIES forum, NOT here
Rules are described in: OraFAQ Forum Guide
Follow them.

Balance question has been asked many times, just search for it.

Regards
Michel
Re: Help to bring Closing Balance from this SQL [message #304385 is a reply to message #304371] Wed, 05 March 2008 00:56 Go to previous message
mshrkshl
Messages: 247
Registered: September 2006
Location: New Delhi
Senior Member
one way would be using SUM() analytical function.

regards,
Previous Topic: Dynamic Variable Declaration how to do ? (merged)
Next Topic: Timestamp Error
Goto Forum:
  


Current Time: Wed Nov 13 04:55:06 CST 2024