Search the Community
Showing results for tags 'duplicates'.
Found 3 results
Hello everyone , Let's say I have an array that contains these numbers: 2,5,7,2,25,6,31,1,24,5,7,8,7,99 How would I make my program be able to tell me something like "There are three 7's". Is it possible to make an array detect duplicates and notify you? Thanks, Brian
Referring to a question posted here, this is a possible SQL query that should do: supposed you have an sqlite table named 'multimedia' with a column named 'sha1_hash', and you want to see only rows with the 'sha1_hash' value that appears more than one time within the table, you could use an SQL query like this: SELECT sha1_hash, COUNT(sha1_hash) AS sha1_sum FROM multimedia GROUP BY sha1_hash HAVING sha1_sum>1 ORDER BY sha1_sum DESC; this query should show only records with the value of sha1_hash that appears more times also in other records, showing it only one time, with a column indicating how many occurrences are present, ordered from the most recurring to the least recurring one. I don't know if this query can be simplified a bit...?, .... if there is a simpler way I would like some hint, Thanks
Hello everyone, I just have a beginner question: is there a way to count duplicates in an array? If you don't see what I mean, here is an example of what I mean: $arr = ['a', 'a', 'b', 'b', 'c'] ; the array countDuplicates($arr); Representing the data in a bidimensionnal array, this would return: #cs ['a'] ['b'] ['c'] Of course this is a bit messy, but that's just for you to get the idea #ce I'm trying to achieve this to check whether yes or no an array has more or same amount of occurrences of a character than another array. Am I doing this the right way? Does such a function exist? Thanks for everything