Use this tag for questions related to Distinct Values, i.e. values that are distinct/unique from the values in a collection.
Questions tagged [distinct-values]
632 questions
-2
votes
2 answers
How to check hashset for an existing element and then adding a count
I'm a beginner in Java and is starting to learn how to use hashsets. I have a problem with my practice exercise. The goal is to remove the duplicate description and then adding the count of similar descriptions.
For example I have,
Computer Science…

Xiaoren
- 29
- 2
- 7
-2
votes
2 answers
Return table listing distinct values in each column
I am familiarizing myself with a data table that has numerous columns for descriptions of individuals' job roles. I would like to return a table that lists in each column the distinct values present in the table for each column.
I understand how to…

jmabs
- 97
- 2
-2
votes
1 answer
MySQL- How to select distinct data against a same record
Referring to the question asked. I have a table which includes multiple records for the same entry like below image
All I want is to select the single record against each entry. I have also set the DB and Query in DB Fiddle
Any help would be…

Moeez
- 494
- 9
- 55
- 147
-2
votes
1 answer
Distinct array of variable
My question is simple.
The array is claimed by a variable.
var array = [1,1,2,2,2,3,3,,4];
How can I get the new array like
array2 = [1,2,3,4]

Barry
- 15
- 4
-2
votes
1 answer
Issue with DISTINCT or GROUP BY on multiple Columns in SQL query
I am using PHP and MYSQL to populate some dropdown lists from a database.
However, I have been at my wits end as to why the following query populates only the first column (City) - and that too without grouping, specified from the bunch of columns…

user3526204
- 509
- 5
- 22
-2
votes
1 answer
I was doing a Distinct Values java Program. I attempt on the Error
This a Method I am using with my Program
static int check(int pos) {
int i, flag = 0;
for (i = 0; i < pos; i++) {
if (a[pos] == a[i]) {
flag = 1;
return 1;
}
}
if (flag == 0)
return…

Daniel Raj
- 11
- 1
- 4
-2
votes
2 answers
Group 1d array data by values and populate subarrays with the original keys
I want to combine all the keys for a same values and make the value as key
Sample data:
Array
(
[825] => ca_knife_features
[838] => ca_knife_features
[795] => ca_knife_handle_materials
[853] => ca_knife_handle_materials…

Rohit Goel
- 3,396
- 8
- 56
- 107
-2
votes
1 answer
How to count all distinct values in each column of table
I want to create a query that satisfies these criteria:
It counts the number of distinct values for each column.
It selects the top three columns that have the greatest number of distinct values.
It counts the number of distinct values…

bmer
- 47
- 9
-2
votes
1 answer
How to find the number of distinct sub strings of n strings?
Given n strings each of length <=10^5.
Input: “aa ab ac ad”
Output: 8 (“a”,”b”,”c”,”d”,”aa”,”ab”,”ac”,”ad”)
Input: “aab bcd”
Output: 10 (“a”,”b”,”c”,”d”,”aa”,”ab”,”bc”,”cd”,”aab”,”bcd”)
update:
suffix tree is one solution.But it takes more…

pavaniiitn
- 311
- 1
- 4
- 18
-2
votes
1 answer
Stata Count Distinct Values
In SQL I would do:
SELECT COUNT(DISTINCT column_name,column_name2) AS some_alias FROM table_name
In Stata I would like to do the same ...
I have not found an easy way to do this ...
For example, I import new panel data for 20 Countries - if…

ill
- 352
- 2
- 4
- 23
-2
votes
1 answer
How to obtain distinct values in knockout js
I'm trying to eliminate duplicate array values and get distinct values in knockout js.
My code is as follows
$.ajax({
url: 'http://localhost:53489/api/datacollect/GetPatientUDData',
type: "GET",
dataType: 'json',
success:…

Matt
- 1
- 1
-3
votes
1 answer
Checking values for a dict of objects in python
I have a list of dicts e.g. [{'X':0,'Y':0},{'X':1,'Y':2}] and I want to check to see if every X and Y value is equal to 0. I have tried some methods such as the all() function and the .values() function but I have been unsuccessful but maybe I have…

Jack Timber
- 45
- 1
- 1
- 5
-3
votes
1 answer
Distinct count of users in the last 7 days for the last 7 days
I want to count the number of unique users in the last 7 days for the last 7 days. I want to build a table that has a column of dates (the current day to 7 days into the past) and the corresponding value is the number of unique users 7 days into the…

JSC
- 181
- 2
- 12
-3
votes
2 answers
i want to select DISTINCT (different) value
i want to select DISTINCT (different) value from (itemof_shop.idreg_shop) column but it is not work.(mysqli)
select distinct
itemof_shop.idreg_shop,
itemof_shop.id
from
itemof_shop
inner join reg_shop on
itemof_shop.idreg_shop =…
-3
votes
2 answers
How to get unique words from a Array[String](It's an array of strings, each string has multiple words) in Scala SPARK
I have a DataFrame which has a column in the form of string. This looks like:
`+--------------------------------------------------------------------------------------------------------------------------------------+
|queue_sequence …

Vikrant
- 139
- 1
- 12