Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Display only duplicate records in Report Builder 3.0 Report

Posted on 2014-02-05
2
1,450 Views
Last Modified: 2014-02-07
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
Comment
Question by:jaisy99
2 Comments
 
LVL 24

Accepted Solution

by:
chaau earned 500 total points
ID: 39837502
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
 
LVL 1

Author Closing Comment

by:jaisy99
ID: 39843747
Thank you.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question