Quick Search:
 
 Oracle PL/SQL: EXISTS 2 Jump to:  
Category: >> Oracle PL/SQL >> EXISTS 2  

<< lastnext >>

Snippet Name: EXISTS 2

Description: Another example of the use of the 'EXISTS' clause.

Also see:
» AND Condition
» Distinct
» Having Clause
» EXISTS
» WITH with CONNECT BY
» WITH Clause: Single alias
» WITH Clause: Double alias

Comment: (none)

Language:
Highlight Mode: PLSQL
Last Modified: March 01st, 2009

SELECT DISTINCT(aps.customer_id), 
       rc.customer_number,
       rc.customer_name,
       SUM(aps.amount_due_remaining)
FROM ar_payment_schedules aps, ra_customers rc 
WHERE aps.customer_id = rc.customer_id
  AND aps.class IN ('CM', 'PMT', 'INV')
  AND aps.status = 'OP'
  AND EXISTS (
         SELECT a.customer_id
         FROM ar_payment_schedules a
         WHERE a.customer_id = aps.customer_id
           AND aps.status = 'OP'
           AND aps.class IN ('CM', 'PMT', 'INV')
           AND TO_CHAR(aps.trx_date, 'J') <= '30-SEP-95' 
         GROUP BY aps.customer_id)
GROUP BY aps.customer_id, rc.customer_number, rc.customer_name;


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org