的SQL語句下面用來工作,幾年前,現在不和我得到這個錯誤信息:1054 - 未知列「XXX」中「的條款」
1054 - 未知列' Promotion_Card_details.Card_id對條款‘
」的’這是我的SQL語句:
SELECT DISTINCT Promotion_Card_details.Card_id,
Promotion_Merchant_details.Merchant_id,
Promotion_details.Promotion_id,
Issuer_details.IssuerName,
Card_details.CCType,
PaymentType_details.PaymentTypeName,
Merchant_details.MerchantName,
PromotionText,
PromotionEndDate
FROM Promotion_details
INNER JOIN Card_details ON (Card_details.Card_id=Promotion_Card_details.Card_id)
INNER JOIN Issuer_details ON (Issuer_details.Issuer_id=Card_details.Issuer_id)
INNER JOIN PaymentType_details ON (PaymentType_details.PaymentType_id=Card_details.PaymentType_id)
INNER JOIN Merchant_details ON (Merchant_details.Merchant_id=Promotion_Merchant_details.Merchant_id)
INNER JOIN Promotion_Merchant_details ON (Promotion_Merchant_details.Promotion_id=Promotion_details.Promotion_id)
INNER JOIN Promotion_Card_details ON (Promotion_details.Promotion_id=Promotion_Card_details.Promotion_id)
WHERE ((Promotion_details.Promotion_id = '13' OR Promotion_details.Promotion_id = '14'
OR
Promotion_details.Promotion_id = '15' OR Promotion_details.Promotion_id = '16' OR
Promotion_details.Promotion_id = '17' OR Promotion_details.Promotion_id = '18' OR
Promotion_details.Promotion_id = '19' OR Promotion_details.Promotion_id = '20' OR
Promotion_details.Promotion_id = '21' OR Promotion_details.Promotion_id = '22' OR
Promotion_details.Promotion_id = '23' OR Promotion_details.Promotion_id = '24' OR
Promotion_details.Promotion_id = '25' OR Promotion_details.Promotion_id = '361'
OR Promotion_details.Promotion_id = '364' OR Promotion_details.Promotion_id = '382'))
任何幫助將不勝感激,因爲我已經試過周圍的某些部分括號,但它仍然有不修復。
你可以發佈你的表的DESC? – 2012-02-10 15:50:59
有人重新命名或刪除了「Promotion_Card_details」表中的字段嗎? – Crontab 2012-02-10 15:54:25
此外,它會使查詢變得更具可讀性,可以將您的'WHERE'子句更改爲使用'IN'而不是'OR'的長列表。 – Crontab 2012-02-10 15:55:10