简体   繁体   中英

How to identify duplicates in data using SQL

Here's my scenario, I am querying a salesforce database and I have certain cases which have different case_id's but the content remains the same. ie the case description, case owner, case assigned team and all other related information are the same.

I can do a self join to identify such cases but my question to all you SQL gurus is - can this be done without using joins? The reason being, all these information is housed in different tables and makes things harder to do a self join?

Try:

SELECT COUNT(CASE_ID), CaseDescription, CaseOwner, CaseAssignedTeam, ...

FROM Table

GROUP BY CaseDescription, CaseOwner, CaseAssignedTeam, ...

HAVING COUNT(CASE_ID)>1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM