SQL返回重复项

时间:2014-12-15 21:09:24

标签: sql duplicates

下面的sql返回重复项。如何删除重复项?

SELECT filteredUni_Reward.uni_statename, uni_rewardtypename, 
       filteredUni_Reward.uni_agencycode, filteredUni_Reward.uni_agencyidname,  
       filtereduni_reward.uni_contactidname, uni_lineofbusinessname, 
       uni_rewardamount, uni_rewarddate, uni_rewardnumber, uni_statusname, 
       uni_approvedbyidname, filteredUni_Reward.createdbyname, 
       filteredUni_Reward.createdon, filteredUni_Reward.owneridname, 
       uni_npnnumber, uni_contacttinverificationname  
FROM filteredUni_Reward 
LEFT JOIN FilteredContact 
         ON filteredcontact.contactid = uni_contactid
INNER JOIN FilteredUni_AgentLicense 
         ON filtereduni_agentlicense.uni_agentlicenseid = uni_agentlicenseid
WHERE filteredUni_Reward.uni_statusname = 'paid' 
      and filteredUni_Reward.statecodename = 'Active' 
      and filteredUni_Reward.createdon >= '2014-01-01 00:00:00' 

1 个答案:

答案 0 :(得分:0)

您是否尝试在distinct声明中使用select?没有一些数据示例,这是您可能从select语句的结果中删除重复项的唯一建议。

Reference for DISTINCT