?
Solved

Finding reapited data in a table

Posted on 2003-03-24
3
Medium Priority
?
279 Views
Last Modified: 2008-03-06
Hi I have set of ISSN numbers about 20,000 of them in a table which some are repeted hence I cant make this field as a primary key, is there a simple sql command i can use to find these repeated numbers and output them (without deleting them first because i need to keep a record of it)...

Cheers
0
Comment
Question by:baz_can_fix_it
[X]
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
3 Comments
 
LVL 4

Accepted Solution

by:
chaos_hooi earned 100 total points
ID: 8200418
To find them....

SELECT * FROM yourtable
WHERE issn IN
 (SELECT issn
  FROM yourtable
  GROUP BY issn
  HAVING COUNT(*) > 1)
ORDER BY issn
0
 
LVL 5

Expert Comment

by:russellshome
ID: 8201639
Slightly more efficient:

SELECT * FROM yourtable
WHERE issn IN
(SELECT issn
 FROM yourtable
 GROUP BY issn
 HAVING COUNT(issn) > 1)
ORDER BY issn
0
 
LVL 1

Author Comment

by:baz_can_fix_it
ID: 8206376
Thank you :)
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

801 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