CanNeverThinkOfaName
Programmer
Hi
I have this following SQL statement where tables can join in various ways but I cannot get the data to return when I add in the last join
The sql is as follows
When I run this I get 9 rows returned.
However when I try to add this join in
(commented out above)
no rows return at all
I've tried both left and right outer joins and neither works.
The 'PURCH_SUBSCRIPTION.TRANSACTIONS_TRANSACTIONS_ID' field is null when I get the 9 rows returning data - and can't join to 'PURCH_SUBSCRIPTION_TRANS.HJID' while it is null- however there are times when it will be null but othertimes when it is filled in!
Is there anyway to represent this scenario please?!!!
I want to add in this join but still get my 9 rows to return
I hope I make sense!!!
Thanks so much for any help in advance!
I'm trying to get to grips with all the joins in a new database and then build a Business Objects Universe when I understand it all!
I have this following SQL statement where tables can join in various ways but I cannot get the data to return when I add in the last join
The sql is as follows
Code:
SELECT PURCH_ORDER.ACCOUNTID, PURCH_ORDER.ORDERDATEELEMENT, PURCH_ORDER.TOTALRATEDAMOUNT,PURCH_SUBSCRIPTION.FREQUENCY,
PURCH_SUBSCRIPTION.FREQUENCYMULTIPLE,
PURCH_TRANSACTION.DEALID, PURCH_TRANSACTION.STATUS, PURCH_TRANSACTION.TRANSACTIONSUBTYPE,
PURCH_SUBSCRIPTION.TRANSACTIONS_TRANSACTIONS_ID, PURCH_PURCHASEDDEAL.TRANSACTIONS_TRANSACTIONS_ID, PURCH_SUBSCRIPTION_TRANS.HJID
FROM PURCH_PURCHASEDDEAL_LINK, PURCH_PURCHASEDDEAL, PURCH_ORDER, PURCH_ORDER_PURCHASEDDEAL, PURCH_PURCHASEDDEAL_SUBS, PURCH_SUBSCRIPTION,
PURCH_SUBSCRIPTION_LINK,PURCH_SUBSCRIPTION_TRANS, PURCH_TRANSACTION_LINK, PURCH_TRANSACTION
WHERE PURCH_ORDER.DEALS_PURCHASEDDEALS_ID=PURCH_ORDER_PURCHASEDDEAL.HJID
AND PURCH_ORDER_PURCHASEDDEAL.HJID=PURCH_PURCHASEDDEAL_LINK.PARENT_PURCHASEDDEALS_ID
AND PURCH_PURCHASEDDEAL_LINK.CHILD_PURCHASEDDEAL_ID=PURCH_PURCHASEDDEAL.PURCHASEDDEALID
AND PURCH_PURCHASEDDEAL.TRANSACTIONS_TRANSACTIONS_ID = PURCH_SUBSCRIPTION_TRANS.HJID
AND PURCH_SUBSCRIPTION_TRANS.HJID=PURCH_TRANSACTION_LINK.PARENT_TRANSACTIONS_ID
AND PURCH_TRANSACTION_LINK.CHILD_TRANSACTION__ID=PURCH_TRANSACTION.TRANSACTIONID
AND PURCH_PURCHASEDDEAL.SUBSCRIPTIONS_SUBSCRIPTIONS__0 =PURCH_PURCHASEDDEAL_SUBS.HJID
AND PURCH_PURCHASEDDEAL_SUBS.HJID = PURCH_SUBSCRIPTION_LINK.PARENT_SUBSCRIPTIONS_ID
AND PURCH_SUBSCRIPTION_LINK.CHILD_SUBSCRIPTION_ID = PURCH_SUBSCRIPTION.SUBSCRIPTIONID
--and PURCH_SUBSCRIPTION.TRANSACTIONS_TRANSACTIONS_ID = PURCH_SUBSCRIPTION_TRANS.HJID(+)
AND TRUNC(PURCH_ORDER.ORDERDATEELEMENT) = TRUNC(SYSDATE) -1
When I run this I get 9 rows returned.
However when I try to add this join in
(commented out above)
Code:
PURCH_SUBSCRIPTION.TRANSACTIONS_TRANSACTIONS_ID = PURCH_SUBSCRIPTION_TRANS.HJID(+)
no rows return at all
I've tried both left and right outer joins and neither works.
The 'PURCH_SUBSCRIPTION.TRANSACTIONS_TRANSACTIONS_ID' field is null when I get the 9 rows returning data - and can't join to 'PURCH_SUBSCRIPTION_TRANS.HJID' while it is null- however there are times when it will be null but othertimes when it is filled in!
Is there anyway to represent this scenario please?!!!
I want to add in this join but still get my 9 rows to return
I hope I make sense!!!
Thanks so much for any help in advance!
I'm trying to get to grips with all the joins in a new database and then build a Business Objects Universe when I understand it all!