下面的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'
答案 0 :(得分:0)
您是否尝试在distinct
声明中使用select
?没有一些数据示例,这是您可能从select语句的结果中删除重复项的唯一建议。