[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1640
  • Last Modified:

Display only duplicate records in Report Builder 3.0 Report

I'm trying to create a report in Report Builder 3.0 that displays only those records that have duplicates for a field's value.  My data source is a model.  Some records are duplicated twice, some up to four times and then the rest are unique.  I want to hide or filter out the unique records and only display records if there is at least one other record in the dataset with the same value.  Any suggestions?  

Thank you,
0
jaisy99
Asked:
jaisy99
1 Solution
 
chaauCommented:
The way you do this is by using grouping with the having clause. Take for example this situation: you have a table with a few columns: Column1, Column2, Column3, Column4. If you are interested in checking for duplicates against Column2 and Column3 you would write a SQL Statement grouping by those two columns only, like this:
SELECT Column2, Column3
FROM Table1
GROUP BY Column2, Column3
HAVING COUNT(*) > 1

Open in new window

If you need to check all columns the SQL statement will look like this:
SELECT Column1, Column2, Column3, Column4
FROM Table1
GROUP BY Column1, Column2, Column3, Column4
HAVING COUNT(*) > 1

Open in new window

The important thing here is to have HAVING COUNT(*) > 1 clause. It allows to select only those records that have the duplications (more than one duplicate records)
0
 
jaisy99Author Commented:
Thank you.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now