我想更有效地實現這一目標而優雅從select語句在SQL
SELECT
MD.*,
(SELECT City FROM PostcodeData WHERE MD.Postcode = Postcode) [City],
(SELECT State FROM PostcodeData WHERE MD.Postcode = Postcode) [State],
(SELECT Areacode FROM PostcodeData WHERE MD.Postcode = Postcode) [Areacode]
FROM MemberDetails AS MD
我能明顯INNER JOIN ON郵編兩個表,但我有問題時,MemberDetail.postcode確實拉動多個值不存在於PostcodeData.postcode中。在這種情況下,我仍然希望選擇這些成員,但對於城市,州和Areacode的結果爲NULL。這在當前查詢中已經實現,但效率很低。任何想法,將不勝感激。乾杯!
乾杯@sgegges,左加入是我之後 – Gregology 2013-02-22 20:08:55