2017-08-17 173 views
-1

如何刪除以下sql中的重複結果?如何刪除sql中的重複項

SELECT * 
FROM  fccestimatedcustomer LEFT JOIN fcccustomerregistration 
ON  fccestimatedcustomer.CustomerRegistrationRefID = 
      fcccustomerregistration.CustomerRegistrationRefID 
WHERE  fccestimatedcustomer.Status = 1 
ORDER BY VehicleNumber ASC; 
+3

谷歌'distinct'。 –

+0

請向我們展示您當前的結果,並告訴我們您想要刪除重複的內容 – Sinto

+0

今天的提示:表格別名! – jarlh

回答

0

最簡單的方法是使用DISTINCT並指定要在其上進行選擇的字段。

1
SELECT DISTINCT * 
FROM  fccestimatedcustomer LEFT JOIN fcccustomerregistration 
ON  fccestimatedcustomer.CustomerRegistrationRefID = 
      fcccustomerregistration.CustomerRegistrationRefID 
WHERE  fccestimatedcustomer.Status = 1 
ORDER BY VehicleNumber ASC; 

嘗試this.If沒有作品,發表您的fccestimatedcustomer的一些示例數據,fcccustomerregistration表