Oracle SQL outer join query puzzle
        Posted  
        
            by 
                user1651446
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user1651446
        
        
        
        Published on 2012-09-06T09:37:17Z
        Indexed on 
            2012/09/06
            9:37 UTC
        
        
        Read the original article
        Hit count: 245
        
So I am dumb and I have this:
select
  whatever
from
  bank_accs b1,
  bank_accs b2,
  table3 t3
where
  t3.bank_acc_id = t1.bank_acc_id and
  b2.bank_acc_number = b1.bank_acc_number and
  b2.currency_code(+) = t3.buy_currency and
  trunc(sysdate) between nvl(b2.start_date, trunc(sysdate)) and nvl(b2.end_date, trunc(sysdate));
My problem is with the date (actuality) check on b2. Now, I need to return a row for each t3xb1 (t3 = ~10 tables joined, of course), even if there are ONLY INVALID records (date-wise) in b2. How do I outer-join this bit properly? Can't use ANSI joins, must do in a single flat query. Thanks.
© Stack Overflow or respective owner