我在做Oracle數據庫項目,名爲「Theatre booking system」。 我想通過Customer_Concession和Member_Concession顯示折扣價格。 可以使用的外鍵是Ticket表中的bookingId,cconcessionId和mconcessionId。 我想要顯示所有票證,即使其中一個id不存在。 如何編寫SQL? 你能幫我嗎? 謝謝。Oracle Sql開發人員如何顯示空的外鍵
SELECT t.ticketId, pro.name "Production name", PRICE.LEVELID "Price level",
Price.price "Price", (Price.price - ccons.discountPrice - mcons.discountPrice)
"Discounted Price", t.seatNo "Seat", t.rowNo "Row", t.block "Block",
per.performance_date "Performance date", per.start_time "Start time",
per.end_time "End time", t.availability "Availability"
FROM Ticket t, Production pro, Performance per, Price, Price_level,
Booking, Customer, Customer_Concession ccons, 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
t.bookingId = Booking.bookingId AND
Booking.customerId = Customer.customerId AND
ccons.cconcessionId = t.cconcessionId AND
mcons.mconcessionId = t.mconcessionId
ORDER BY t.ticketId
Oh..it很容易解決!謝謝! – wholee1 2012-03-26 20:28:37