Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Finding reapited data in a table

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
baz_can_fix_it
Asked:
baz_can_fix_it
1 Solution
 
chaos_hooiCommented:
To find them....

SELECT * FROM yourtable
WHERE issn IN
 (SELECT issn
  FROM yourtable
  GROUP BY issn
  HAVING COUNT(*) > 1)
ORDER BY issn
0
 
russellshomeCommented:
Slightly more efficient:

SELECT * FROM yourtable
WHERE issn IN
(SELECT issn
 FROM yourtable
 GROUP BY issn
 HAVING COUNT(issn) > 1)
ORDER BY issn
0
 
baz_can_fix_itAuthor Commented:
Thank you :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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