我試圖讓這個查詢工作:SQL查詢不產生任何結果
SELECT Stock.*,
StockFeatures.Features,
StockDescriptions.Detailed,
StockDescriptions.Technical,
PRD1.RuleValue as Price,
PRD2.RuleValue as WasPrice,
PRD2.RuleValue-PRD1.RuleValue as Save,
PRD1.Quantity
FROM
StockFeatures, Stock INNER JOIN
PriceRuleDetail PRD1 ON PRD1.Sku = Stock.Sku
AND PRD1.PriceRule = 'RG' LEFT JOIN
PriceRuleDetail PRD2 ON PRD2.Sku = Stock.Sku
AND PRD2.PriceRule = 'RRP' LEFT JOIN
StockDescriptions ON StockDescriptions.Sku = Stock.Sku
WHERE Stock.GeneralStkStatus < 3
AND Stock.Sku = '11044'
AND StockFeatures.Sku = Stock.Sku
ORDER BY PRD1.Quantity ASC
它時,沒有一個StockFeatures.Features行的StockFeatures表不返回任何結果 - 這也經常不會是。我該如何使它只在該表中沒有任何內容時纔會出現NULL值?
該表具有Sku和特徵(Sku應與Stock.Sku列鏈接)列。
任何幫助,將不勝感激。
在此先感謝。
我很抱歉,但如果沒有StockFeature(如你所說,它可能爲空),你想加入該怎麼行Stock.Sku ?????或者你只是想要一整行的空值? – gbianchi 2010-01-15 15:25:49