I am going to try to use left outer join between Ticket and Membership.
However, it does not display the foreign key of NULL values on Ticket. Could you give me some answer for this what’s wrong with this query?
Thanks.
FROM Ticket t, Production pro, Performance per, Price, Price_level, Booking, Customer, Customer_Concession ccons, Membership, Member_concession mcons
WHERE t.performanceid = per.performanceid AND
t.PRODUCTIONID = Price.PRODUCTIONID AND
t.levelId = Price.levelId AND
Price.PRODUCTIONID = pro.PRODUCTIONID AND
Price.levelId = Price_level.levelId AND
Booking.bookingId (+) = t.bookingId AND
Customer.customerId = Booking.customerId AND
ccons.cConcessionId (+) = Customer.cConcessionId AND
Membership.membershipId (+) = t.membershipId AND
Membership.mConcessionId = mcons.mConcessionId
ORDER BY t.ticketId
One potential problem you have is these two conditions:
Since you’re doing an outer join to
Booking, its columns will appear asNULLwhen no match is found; but then your doing a normal join toCustomer, so those rows will be eliminated sinceNULLcannot be equal to anything. You may want to change the second line to an outer join as well.But, I don’t know if that’s your primary problem, since I don’t actually understand exactly what you’re asking. What do you mean by “NULL value of the foreign key”? You haven’t specified what your foreign keys are.