Combine two large tables into one external Oracle SQL join by combining across the COBILL or COBILLSERVICE .
select count (bs.COBILLSERVICE), count (distinct b.cobill), count (distinct b.cocontract) from bill b left OUTER JOIN BILLSERVICE bs on b.COBILL = bs.COBILL where bs.EXTERNALNUMBER >= 245491119 and bs.EXTERNALNUMBER <= 246278122 and b.COSOURCE = 2 select count (bs.COBILLSERVICE), count (distinct b.cobill), count (distinct b.cocontract) from bill b left OUTER JOIN BILLSERVICE bs on b.COBILL = bs.COBILL where b.createdate > to_timestamp ('04.09.17 19:51:10,910000000', 'DD.MM.YY HH24:Mi:SS,FF') and b.createdate < to_timestamp ('04.09.17 22:40:37,336000000', 'DD.MM.YY HH24:Mi:SS,FF') and b.cosource = 2
b.createdate. - Deft