Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 13th, 2004, 02:17 AM
vhin vhin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 vhin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need Help Multiple-Row Subqueries

TABLE IFGLM_CHART_OF_ACCOUNTS
CHART_OF_ACCOUNT_ID NUMBER (15) NOT NULL,
ACCOUNT_TITLE VARCHAR2 (200) NOT NULL,

TABLE IFGLT_BALANCES
BALANCE_ID NUMBER (15) NOT NULL,
MONTHLY_BAL_ID NUMBER (15),
CHART_OF_ACCOUNT_ID NUMBER (15) NOT NULL,
TRAN_YY NUMBER (4) NOT NULL,
TRAN_MM NUMBER (2) NOT NULL,
DEBIT_AMT NUMBER (18,2) DEFAULT 0 NOT NULL,
CREDIT_AMT NUMBER (18,2) DEFAULT 0 NOT NULL,
TRAN_BAL NUMBER (18,2) DEFAULT 0 NOT NULL,

In this query, it will display revenue accounts for the year 2004 for the month of April, with its current amount and balances.

SELECT GLCOA.CHART_OF_ACCOUNT_ID COAID, GLCOA.ACCOUNT_TITLE TITLE,
GLBAL.TRAN_YY, GLBAL.TRAN_MM,
(GLBAL.CREDIT_AMT-GLBAL.DEBIT_AMT) CURRNT_MO, GLBAL.TRAN_BAL,
FROM IFGLT_BALANCES GLBAL, IFGLM_CHART_OF_ACCOUNTS GLCOA
WHERE
GLBAL.CHART_OF_ACCOUNT_ID=GLCOA.CHART_OF_ACCOUNT_ID(+)
AND GLBAL.CHART_OF_ACCOUNT_ID BETWEEN 533 AND 613
AND GLBAL.TRAN_YY=2004
AND GLBALA.TRAN_MM=4;

COAID TITLE TRN_YY TRN_MM CURRNT_MO TRN_BAL
001, rev01, 2004, 04, 150, 250
002, rev02, 2004, 04, 75, 150

COAID TITLE
001, rev01
002, rev02

COAID TRN_YY TRN_MM CURRNT_MO TRN_BAL
001, 2004, 04, 150, 250
002, 2004, 04, 75, 150
001, 2003, 04, 200
002, 2003, 04, 250



multiple-row sub queries column(*TRANBAL) twice from IFGLT_BALANCES,with reference current and previous year(*TRAN_YY) with this outputs:
current: GLBAL.CREDIT_AMT-GLBAL.DEBIT_AMT
Parameter: tran_yy and tran_mm.


COAID Misce current cumltive Prev inc/
Incme: 04,2004 04,2004 04,2003 (dec)
Title
001, rev01, 150, 250, 200, 50
002, rev02, 75, 150, 250, (100)

Total 225, 400, 450, (50)

Reply With Quote
  #2  
Old June 16th, 2004, 11:57 AM
astrocanis astrocanis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 14 astrocanis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to astrocanis
what is the question?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Need Help Multiple-Row Subqueries


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway