21,716 questions
-4
votes
3
answers
165
views
Returning multiple columns and count of duplicates with GROUP BY clause
I'm searching for duplicate values per column and need a count of them and data from some additional columns.
Table sample
BillNr
Name
email
1000
Shakira
[email protected]
1001
Shakira
[email protected]
...
0
votes
3
answers
89
views
make a list according to max count [duplicate]
I have a list
my_list = [3,8,11,8,3,2,1,2,3,3,2] # my list
max(my_list, key=my_list.count) # most frequent number appeared on the list
But i want to make a list according to the most frequent ...
1
vote
4
answers
221
views
Count columns until the value changes
I have a table that has values for each week in each column. I want to count the number of consistent values starting from the first week until it changes. I've tried searching for answers but I ...
0
votes
1
answer
57
views
MySQL Aurora slow COUNT query
I have a COUNT(*) query that is really fast in several DB's, but is really slow on MySQL AURORA:
I can't seem to figure out why. First I thought it was because it went the MEMORY went over the 4MB, ...
2
votes
2
answers
114
views
Invalid identifier when using aggregate count(*) [duplicate]
I need to count the number of students who were registered in a given course over an academic year.
The following SELECT query returns a column of course numbers and a column of the academic year.
...
3
votes
3
answers
182
views
Reduce nested IF…ELSE conditions that iteratively condition building a query by adding filters one by one
My stored procedure has this structure:
if Count 1>0 then
count 2 with (condition 1,)
if Count 2>0 then
count 3 with (condition 1,2)
if Count 3>0 then
count 4 with(condition ...
0
votes
0
answers
64
views
Database or data structure for fast exact counting
In databases such as PostgreSQL, doing exact counts like select count (*) from table where condition perform a full table scan.
PostgreSQL will need to scan either the entire table or the entirety
of ...
2
votes
3
answers
116
views
Query count & sum nested selects into a Grouped Category
My current project/issue is we have a list of permit types. With these types they are needing to be grouped by an overall category. Once grouped out the end goal is to count how many within specified ...
0
votes
2
answers
91
views
Efficiently Count Number of Ones at Deepest Level in Recursive Floor-Ceil Splitting of Large Binary Number
I have a number represented as a large binary string (length can be up to 1 million bits). The number is recursively split as follows:
At each step, divide the number
x into two parts:
floor(x/2) and ...
1
vote
1
answer
108
views
Counting Emails in Subfolder automatically in Excel
I am trying to get a cell in excel to display a total count of emails in a given subfolder from a specific outlook account (which is a shared mailbox).
Two questions: How to specify which Outlook ...
0
votes
0
answers
26
views
Monthly Count of labels entered into a Gsheet
I can manually see the number of conversations in each label in the settings screen.
I want to pull this data monthly and automatically add the count in a Gsheet so I can see the trend over time. Can ...
0
votes
0
answers
67
views
How to aggregate by a set of columns and turn groups on columns with counts of the same dataframe in R? [duplicate]
I´ve got a large dataframe that I´ve got to aggregate and then show counts by geo, the lines should be unique by product, sex and education… already use dplyr to group by and then count but only get ...
-1
votes
2
answers
62
views
Unique Values Count
I have a small list of employees, and how much units they finished a given day. But I have duplicate values, because they have to place multiple components. List looks something like this:
Employee
...
0
votes
0
answers
20
views
Count tinyint columns with specific value [duplicate]
I have table with tinyint and I want to count positive and negative values.
I tried the following example (simplified) but the results are wrong. There are 4 (1) in table so I expect like_count to be ...
2
votes
3
answers
143
views
Double aggregation function
I have the result of a subquery:
SELECT
maker, p.type, COUNT(DISTINCT pc.model) pcs
FROM
Product p
INNER JOIN
Pc pc ON p.model = pc.model
GROUP BY
maker, p.type
UNION
SELECT
...
1
vote
1
answer
78
views
SAS - Count how many times a value appear in a field for each record
I have the following SAS dataset, with a single columns called STAT (This field contains a series of values for each record):
I need to create a new field called CountOpen that, for each row, counts ...
1
vote
3
answers
96
views
MySQL, join to find only max transaction count based of group
I am trying to find the max of transactions count based on type for each user.
id
user_id
type
1
1
A
2
1
B
3
1
C
4
1
A
5
2
B
6
2
C
7
2
C
8
2
C
I am expecting the output to be:
user_id
type
count
1
A
2
...
0
votes
1
answer
101
views
How can I use the COUNT and GROUP BY along with the CASE commands in SQLlite to show the number of students with each letter grade?
I am trying to use the SQL commands COUNT and GROUP BY to show the number of students with each letter grade, but I'm having difficulty in doing so. A new column that I created contains a letter grade ...
0
votes
4
answers
123
views
remove duplicates in csv column and count them adding new column with the count number
I need help to remove duplicates in the 4th column (num3) in that csv file, then add new column named (count) at the end with number of duplicates for every number in column, the sort all the rows due ...
0
votes
1
answer
58
views
Count a value in multiple sheets in a workbook
I have one workbook.
The workbook has 12 sheets.
Each sheet is named something like Bob Smith,. Jim Jones etc.
Each sheet has one named table , Table1, Table2, etc
Each table has a Status column with ...
3
votes
3
answers
129
views
How do I count the number of columns that have at least a cell where the number is greater than 0?
Year
a
b
c
2017
0
1
3
2018
0
3
0
2019
0
0
0
Given the table above, what's an excel formula to help me count how many columns have at least one cell that's greater than 1? Would prefer to have a ...
2
votes
1
answer
92
views
google sheets array formula for boolean logic based on duplicate numbers per cell
I have a column A that looks like:
11
11 11
5 6
5 5
5 6 6 5
11 11 11 11
6 7 8
3
3 2 3
and seeking for an alternative-smarter way how to output TRUE/FALSE as shown here:
desired result
11
TRUE
FALSE
...
0
votes
1
answer
92
views
How to count the number of times a value has appeared so far in a Python pandas dataset? [duplicate]
I have two datasets from an animal shelter that include Animal IDs and dates. One set is for intakes, one is for outcomes. Some Animal IDs are duplicated, typically because the same animal has entered/...
2
votes
2
answers
98
views
R dplyr count occurrences that are in multiple conditions [closed]
I am new to dplyr, and I would be curious about a fast way to get from this data:
ID
Age
YearDied
100
2
2005
102
4
NA
103
1
NA
106
5
2002
108
1
NA
109
1
NA
110
4
NA
112
3
NA
To this data (counting ...
0
votes
1
answer
94
views
How to efficiently filter specific values from a dataset and group those filtered values based on their counts for a plot
I have a large dataset (5m+ records) of NYC crimes. I want to select 5 crimes from the column 'OFNS_DESC' and group the crimes according to the number of occurrences within a month so that I can plot ...
1
vote
1
answer
53
views
Count And Grouping with PHP and MongoDB with PHP
Manipulating JSON array using PHP and MONGO DB.
I have the following nested JSON, I need to counts the Repeated Persons to depurate the collecction, in the sample are 4 records but really are 2000 ...
2
votes
2
answers
99
views
Is it possible to query the state of an updated table in postgresql within the same query?
I want to update a table in a WITH query (not a requirement, if it's achievable another way that's fine too) and count rows of the updated table (including the updated row) for the subsequent query.
...
0
votes
1
answer
45
views
How to use count in dexie.js?
I'm trying to count how many records I have in a table using dexie.js
I try this: alert(db.table.count()); and browser return: [object Dexie.Promise]
If I use console.log(db.table.count()); the ...
0
votes
2
answers
70
views
Group count on derived table in Teradata
I'm trying to create a frequency count table on a derived healthcare table of member age in months when receiving a first medical diagnosis (datediff(month,d.birthdate,d.min_claimdate)).
My cleaned up ...
0
votes
1
answer
94
views
Grafana - Dashboard Variable - KQL - count not working
I am trying to get a row count in a Grafana dashboard, and was working fine when I first set it up. But now I am seeing inconsistent results in Grafana and ADX: Specifically, Grafana variable is ...
0
votes
0
answers
124
views
The "cout" command does not display the message I want on the screen
I'm using VScode on Windows to program in C++.
The printf command works, but the cout command doesn't work. The compiler doesn't show me an error, either. I've already installed all of the necessary ...
3
votes
2
answers
153
views
How do I add counts to a stacked bar graph?
Here is my graph so far:
counts <- table(all_study$study, all_study$time_of_day_num)
barplot(counts, main="Distribution of Enrollment Time by Study for 24-25",
col=c("blue&...
0
votes
1
answer
92
views
load data stopped prematurely
I uploaded a file with 4 million rows to a table.
The table is a database of vehicle license plates along with all the characteristics of that vehicle (color, tire size, engine capacity, and more).
...
1
vote
1
answer
47
views
count files in folder by taking path from row cells
Sub TEST()
Dim Path As String, r As Range, filename As String, count As Integer
r = Range("J2")
Path = r & "*.docx"
On Error Resume Next
filename = Dir(Path)...
0
votes
2
answers
232
views
Excel Formula to find unique and duplicate values in various ranges, and then count
I need some help writing a formula in excel to count how many days I had a staff member present at each particular site.
My actual spreadsheet is a bit more complex, so I have drafted a simple version ...
1
vote
1
answer
84
views
How can I count and show Unicode Characters when insert onclick to textarea?
I insert Unicode-Smiley to HTML textarea. I have an second JS script to count characters typed by user to limit the length in the textarea, this is the JS code.
Now, when the Unicode smiley inserted ...
0
votes
0
answers
25
views
Utilizing a column with unique values as the count of occurences
I have a list that stores different incidents that occur. That list feeds a Power BI report to visualize the data. Up until now each item in the list represented a single occurrence. One of our ...
-1
votes
1
answer
32
views
django category count, print can't filtered
i want to solve django category problem
i want print out, counting as category data.
for example
python (3)
html (2)
but result
python ({{ category.post_set.count }})
html ({{ category.post_set....
0
votes
1
answer
51
views
Return the number of objects in a slicer from another workbook
I am simply trying to get the number of objects in a slicer from another workbook.
Let's suppose I'm working on excel's workbook A.
I'm using the following code :
Sub slicerCount()
Dim wb As Workbook
...
1
vote
1
answer
156
views
Snowflake - COUNT (DISTINCT ...) window function with ORDER BY
The goal is to find an equivalent of DISTINCT inside window COUNT for a sliding/cumulative window. According to COUNT:
When this function is called as a window function with an OVER clause that ...
0
votes
1
answer
39
views
LINQ - DataTable GroupBy Count Distinct
I am trying to join to tables together in vb.Net using linq to return the distinct count of the primary keys, and I can't quite seem to get the syntax
Here's the code to create the tables
Dim ...
0
votes
1
answer
290
views
Excel Distinct Counts on Pivot Tables are aggregating incorrectly
I have the followng table in Excel and I am trying to aggregate the distinct counts, in a pivot table, however the values are off and I am wondering why. I am using the distinct count option within ...
1
vote
2
answers
131
views
Return Distinct Concat Count if More Than One Result
I'm trying to get a distinct count of multiple columns grouped by another column, but I want the results to only include counts greater than ONE. So if I have the following:
SELECT *
FROM cast
ORDER ...
0
votes
1
answer
99
views
How to introduce a random error within a Bayesian count model?
I am trying to model counts distribute across groups in JAGS, but I need to add a random effect for the presence of multiple counts from the same individual.
The model is taken from here
enter link ...
1
vote
2
answers
146
views
Select counts from one table based in the results from another table
I have two tables, lets call them t1 and t2. Fiddle
select setseed(.42);
create table t1(a,b,c,d)as
select (random()*9)::int
, (random()*9)::int
, (random()*9)::int
, (random()*9)::int
...
0
votes
2
answers
55
views
Expression Engine Entries Loop Index
Does Expression Engine entries loop have a variable to show which index you're on for each iteration? I found the {count} and {total_results} in the docs, but cant seem to find the variable that spits ...
0
votes
0
answers
38
views
Why does count parameter say the value needs to be less than or equal to -83 [duplicate]
I have an array of indexes. These indexes are the first letter after a space in the given title parameter. I'd like to capitalize the first letter of each word after the spaces. I am also making all ...
1
vote
3
answers
54
views
Count occurences (rows) between dates (SPSS)
I have data on surgeries, every row represent a patient with a performed surgery. I wish to answer the question: How many procedures has this surgeon performed in the last year (at that time of the ...
0
votes
1
answer
61
views
Get daily count of items which have a start_date and an end_date
I do have tours in a table which do have a start date and an end date, e.g.
id
start_date
end_date
1
2025-06-13
2025-06-13
2
2025-06-12
2025-06-17
3
2025-06-20
2025-06-21
4
2025-05-31
2025-06-02
and ...
1
vote
1
answer
88
views
Add column count of occurrences
I have table in SQL Server called df found here:
-- Parameters
DECLARE @Year INT = 2020; --, @Country varchar(50)= 'Brazil';
WITH ModeData AS (
SELECT country,
a.Mode
FROM df
...