Click here to Skip to main content
13,189,884 members (49,732 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.7K views
4 bookmarked
Posted 5 Apr 2010

Reading Duplicate Values from the Table

, 7 Apr 2010
Rate this:
Please Sign up or sign in to vote.
Hi, on many occasions we want to search some repeated values in one or more columns. It is quite simple to do this...select ColumnName, count(ColumnName) as NumberOfTimesfrom TableNameGroup By ColumnNamehaving (count(ColumnName) > 1)At the same time, there is also a requirement...
Hi, on many occasions we want to search some repeated values in one or more columns. It is quite simple to do this...

select ColumnName, count(ColumnName) as NumberOfTimes
from TableName
Group By ColumnName
having (count(ColumnName) > 1)


At the same time, there is also a requirement to find how many rows with primary key have duplicate values:

select PrimaryKeyColumn,
from TableName
where ColumnNamein (
select ColumnName
from TableName
group by ColumnName
having (count(ColumnName) > 1

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Indrajeet Sutar
Software Developer (Junior) Excel Informatics, Pune
India India
Am Indrajeet T. Sutar. I am a web developer. I am working on .net technology. I have completed my Masters in Computers and Management (people call it as MCA, MBA etc.) Apart from programming i do photography (not regularly though), traveling and reading books.

You may also be interested in...

Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171016.2 | Last Updated 7 Apr 2010
Article Copyright 2010 by Indrajeet Sutar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid