469,283 Members | 2,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

Select query for Ageing Report 30,60,90 days

11
Dears,

Help me how to create a ageing report for 30 days,60 days and 90 days, anyone can help me to have standard select query.

Opening Balance
30 days
60 days
90 days

thanks in advance,
moyoal
Mar 19 '08 #1
4 19118
amitpatel66
2,367 Expert 2GB
Dears,

Help me how to create a ageing report for 30 days,60 days and 90 days, anyone can help me to have standard select query.

Opening Balance
30 days
60 days
90 days

thanks in advance,
moyoal
Could you provide more detail on what exactly you want in your report?
More information (columns required, sample data) ?
Mar 19 '08 #2
moyoal
11
example

Header Details

customer No: xyz
From Date : 01-01-2007
to Date : 01-12-2007

cust Open Bal : <sum(credit-debit) before From Date i.e 01-01-2007>

================================================== ======
Line Details
Description Date Debit Credit
Debit 20-01-2007 2000 0
Credit 21-01-2007 0 1000

----------------------------------------------------------------------------------------------------------------
Total (Debit - Credit)
----------------------------------------------------------------------------------------------------------------

here what i want, credit of customer in last 30 days how much and in 60 days how much and 90 days how much

30 days Credit 60 days credit 90 days credit
100 500 400

please help me to create a query to get 30, 60 and 90 days credit amount

awaiting





Could you provide more detail on what exactly you want in your report?
More information (columns required, sample data) ?
Mar 19 '08 #3
amitpatel66
2,367 Expert 2GB
Try something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT SUM(amount) FROM table1 WHERE date_column BETWEEN SYSDATE - 30 AND SYSDATE
  3. UNION ALL
  4. SELECT SUM(amount) FROM table1 WHERE date_column BETWEEN SYSDATE - 60 AND SYSDATE
  5. UNION ALL
  6. SELECT SUM(amount) FROM table1 WHERE date_column BETWEEN SYSDATE - 90 AND SYSDATE
  7.  
  8.  
Mar 19 '08 #4
Please realize the amount of data you're talking about.

Expand|Select|Wrap|Line Numbers
  1.  SELECT hp.party_name,
  2.         SUM(apsa.amount_due_remaining),
  3.         SUM(apsa.amount_due_original),
  4.         CASE 
  5.             WHEN sysdate - rcta.trx_date >= 90 THEN 90
  6.             WHEN sysdate - rcta.trx_date >= 60 THEN 60
  7.             WHEN sysdate - rcta.trx_date >= 30 THEN 30
  8.             ELSE 00           
  9.         END GROUP
  10.  FROM  ar.hz_cust_accounts hca                                                
  11.  INNER JOIN ar.ra_customer_trx_all rcta ON hca.cust_account_id = rcta.bill_to_customer_id          
  12.  INNER JOIN ar.ar_payment_schedules_all apsa ON rcta.customer_trx_id = apsa.customer_trx_id
  13.  INNER JOIN ar.hz_parties hp ON hca.party_id = hp.party_id 
  14.  GROUP BY hp.party_name,
  15.         CASE 
  16.             WHEN sysdate - rcta.trx_date >= 90 THEN 90
  17.             WHEN sysdate - rcta.trx_date >= 60 THEN 60
  18.             WHEN sysdate - rcta.trx_date >= 30 THEN 30
  19.             ELSE 00           
  20.         END;
  21.  
Aug 27 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by amith.srinivas | last post: by
1 post views Thread by Stoney59 | last post: by
2 posts views Thread by sara | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.