sql server中用left join 连接多张表,出现重复数据,如何去掉重复数据?
SELECTa.bizArea,c.tranOutDate,a.cntNo,b.custName,d.productname,d.matSpec,d.amountReal...
SELECT a.bizArea,c.tranOutDate,a.cntNo,b.custName,d.productname,d.matSpec,d.amountReal,d.unitPrice,a.cntType,d.amountMoney
FROM crm_deliver c
left join crm_deliverDetail d on c.deliverNo=d.deliverID
left join crm_contractbaseinfo a on c.crtNO=a.cntNo
left join crm_termianlcustbaseinfo b on a.cntCustomerNo=b.custNo
WHERE c.tranOutDate BETWEEN '2014-3-1' and '2014-4-15' 展开
FROM crm_deliver c
left join crm_deliverDetail d on c.deliverNo=d.deliverID
left join crm_contractbaseinfo a on c.crtNO=a.cntNo
left join crm_termianlcustbaseinfo b on a.cntCustomerNo=b.custNo
WHERE c.tranOutDate BETWEEN '2014-3-1' and '2014-4-15' 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询