Questions tagged [duplicates]

The "duplicates" tag concerns detecting and/or dealing with multiple instances of items in collections.

Filter by
Sorted by
Tagged with
2238votes
38answers
3.3mviews

Finding duplicate values in a SQL table

It's easy to find duplicates with one field: SELECT email, COUNT(email) FROM users GROUP BY email HAVING COUNT(email) > 1 So if we have a table ID NAME EMAIL 1 John asd@asd.com 2 Sam ...
user avatar
  • 32.2k
1951votes
54answers
2.4mviews

Remove duplicate values from JS array [duplicate]

I have a very simple JavaScript array that may or may not contain duplicates. var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"]; I need to remove the duplicates and put the unique ...
user avatar
  • 19.8k
1347votes
41answers
1.3mviews

How can I remove duplicate rows?

What is the best way to remove duplicate rows from a fairly large SQL Server table (i.e. 300,000+ rows)? The rows, of course, will not be perfect duplicates because of the existence of the RowID ...
user avatar
  • 65.8k
1276votes
57answers
1.9mviews

Removing duplicates in lists

Pretty much I need to write a program to check if a list has any duplicates and if it does it removes them and returns a new list with the items that weren't duplicated/removed. This is what I have ...
user avatar
  • 18k
911votes
33answers
641kviews

How do you remove duplicates from a list whilst preserving order?

Is there a built-in that removes duplicates from list in Python, whilst preserving order? I know that I can use a set to remove duplicates, but that destroys the original order. I also know that I can ...
user avatar
  • 23.4k
721votes
24answers
707kviews

Fastest way to duplicate an array in JavaScript - slice vs. 'for' loop

In order to duplicate an array in JavaScript: Which of the following is faster to use? Slice method var dup_array = original_array.slice(); For loop for(var i = 0, len = original_array.length; i < ...
user avatar
  • 32.2k
704votes
25answers
853kviews

Find duplicate records in MySQL

I want to pull out duplicate records in a MySQL Database. This can be done with: SELECT address, count(id) as cnt FROM list GROUP BY address HAVING cnt > 1 Which results in: 100 MAIN ST 2 I ...
user avatar
  • 14.2k
685votes
73answers
820kviews

How to remove all duplicates from an array of objects?

I have an object that contains an array of objects. obj = {}; obj.arr = new Array(); obj.arr.push({place:"here",name:"stuff"}); obj.arr.push({place:"there",name:"...
user avatar
  • 8,172
659votes
15answers
776kviews

Removing duplicate rows in Notepad++

Is it possible to remove duplicated rows in Notepad++, leaving only a single occurrence of a line?
user avatar
637votes
7answers
643kviews

Find duplicate lines in a file and count how many time each line was duplicated?

Suppose I have a file similar to the following: 123 123 234 234 123 345 I would like to find how many times '123' was duplicated, how many times '234' was duplicated, etc. So ideally, the ...
user avatar
  • 6,433
595votes
39answers
1.1mviews

How do I find the duplicates in a list and create another list with them?

How can I find the duplicates in a Python list and create another list of the duplicates? The list only contains integers.
user avatar
  • 17.3k
562votes
31answers
710kviews

Remove duplicates from a List<T> in C#

Anyone have a quick method for de-duplicating a generic List in C#?
user avatar
  • 36.3k
546votes
39answers
896kviews

How do I remove repeated elements from ArrayList?

I have an ArrayList<String>, and I want to remove repeated strings from it. How can I do this?
user avatar
  • 5,623
502votes
24answers
1.1mviews

How to delete duplicate rows in SQL Server?

How can I delete duplicate rows where no unique row id exists? My table is col1 col2 col3 col4 col5 col6 col7 john 1 1 1 1 1 1 john 1 1 1 1 1 1 sally 2 2 2 ...
user avatar
  • 9,479
489votes
5answers
1.0mviews

How do I (or can I) SELECT DISTINCT on multiple columns?

I need to retrieve all rows from a table where 2 columns combined are all different. So I want all the sales that do not have any other sales that happened on the same day for the same price. The ...
user avatar
  • 30.7k

15 30 50 per page
1
2 3 4 5
1024