关于下面SQL语句肯能产生的错误,求指点
SELECT DISTINCT RE_RepairBills.cHouseCode,RE_RepairBills.dCheckTime,RE_RepairBills.cReBillCode, RE_InDepotLog.cGoodsCode, RE_RepairBills.cHouseCode, MT_Goods.cGoodsPN, MT_Goods.cGoodsCName, CASE RE_RepairBills.cBillType WHEN '200611070002' THEN 'DOA新品' WHEN '200611070001' THEN '新品' ELSE '新品' END AS shuxing, SUM(RE_InDepotLog.rAmont) AS 'rAmont', MT_Goods.cGoodsPN AS 'cGoodsPN1', MT_Goods.cGoodsCName AS 'cGoodsCName2', RE_InDepotLog.cGoodsCode AS 'cGoodsCode2'FROM RE_RepairBills LEFT OUTER JOIN RE_InDepotLog ON RE_RepairBills.cReBillCode = RE_InDepotLog.cReBillCode LEFT OUTER JOIN MT_Goods ON MT_Goods.cGoodsCode = RE_InDepotLog.cGoodsCodeWHERE (RE_RepairBills.cBillState = '检测') AND (RE_InDepotLog.cReGoodsClassCode = '200611180001') and (RE_RepairBills.isread is NULL or RE_RepairBills.isread='0') and (RE_RepairBills.cHouseCode='200604100018') and (RE_RepairBills.dCheckTime>'2010-7-21' AND RE_RepairBills.dCheckTime<'2010-7-22')
and (RE_RepairBills.cHouseCode='200604100018')
[解决办法]
SELECT DISTINCT RE_RepairBills.cHouseCode,RE_RepairBills.dCheckTime,RE_RepairBills.cReBillCode, RE_InDepotLog.cGoodsCode, RE_RepairBills.cHouseCode, MT_Goods.cGoodsPN, MT_Goods.cGoodsCName, CASE RE_RepairBills.cBillType WHEN '200611070002' THEN 'DOA新品' WHEN '200611070001' THEN '新品' ELSE '新品' END AS shuxing, SUM(RE_InDepotLog.rAmont) AS 'rAmont', MT_Goods.cGoodsPN AS 'cGoodsPN1', MT_Goods.cGoodsCName AS 'cGoodsCName2', RE_InDepotLog.cGoodsCode AS 'cGoodsCode2'FROM RE_RepairBills LEFT OUTER JOIN RE_InDepotLog ON RE_RepairBills.cReBillCode = RE_InDepotLog.cReBillCode LEFT OUTER JOIN MT_Goods ON MT_Goods.cGoodsCode = RE_InDepotLog.cGoodsCodeWHERE (RE_RepairBills.cBillState = '检测') AND (RE_InDepotLog.cReGoodsClassCode = '200611180001') and (RE_RepairBills.isread is NULL or RE_RepairBills.isread='0') and (RE_RepairBills.cHouseCode='200604100018') and (RE_RepairBills.dCheckTime>'2010-7-21' AND RE_RepairBills.dCheckTime<'2010-7-22')