Questions tagged [count]
Count refers to the number of objects in a collection. It's also a commonly-used SQL function that counts the number of rows.
21,378
questions
0
votes
1
answer
30
views
VBA to count cells by colour in one column when a specific word in another column
I'm trying to find some VBA to count cells by colour in a range when there is specific word in an adjacent range.
I've found VBA to count cells by colour but I want to extend this so that I only count ...
2
votes
1
answer
27
views
How to display the details of the most frequently referenced entry
So I have a table which is for tickets within an IT helpdesk. Each Ticket "ID_TICKET" is related to a specific fault and has an associated computer "SERIAL_NO_COMPUTER".
I want to ...
-1
votes
4
answers
46
views
Counting the frequency of 'BB' or 'EE' in a string using Python [duplicate]
I'm trying to count every time a string appears in a given string
I'm trying to count the number of times 'BB' or 'EE' appear, for example BB would give 1, and BBB would give 2 from 'BB'B and B'BB'. ...
1
vote
1
answer
20
views
group array of objects and get the count in mongodb
I am having an array of objects:
[
{
medicationDetails: {
category: 'Asthma',
subCategory: '',
providedBy: 'Doctor'
}
},
{
medicationDetails: {
category: '...
0
votes
2
answers
24
views
MySql count with GROUP BY returns 1 even when count is 0
I have two tables in MySql i.e., subjects and photos and I wished to count the number of photos on each subjects
SELECT a.id, a.name, count(a.id) as `refcount`,
FROM `subjects` a
LEFT JOIN `photos` ...
0
votes
1
answer
16
views
How can I add a field that counts items in another field in Redshift
I am looking for a way to list multiple counts of various groups of content from a row using Redshift. For example, I have a row containing process, md5, and path. I have a query to count each ...
-1
votes
0
answers
32
views
t-sql is it possible to use COUNT() or analogue in recursive cte [closed]
I have such recursive cte. I use count (s_) over (partition by c) cc in column cc in recursive part cte. But I get "1" in result,
but i need to get such result in recursive cte (see my ...
0
votes
1
answer
63
views
Add comma separated count from list of string
I have a column named diff_2 in my df, which is of this form:
diff_2
Backward compatibility errors (16):
error at /Users, in API GET /studies/{studyId} the response property 'id' became optional for ...
0
votes
0
answers
22
views
Operation must use an updateable query [duplicate]
I'm going in circles with this query that I need to build. Your help is really appreciated.
I have the below tables:
Import(ID, RPTKey, Name, CountS)
Export (ID, RPTKey, Region)
I need to count or ...
-1
votes
1
answer
30
views
sum or count values/string based on multiple columns in R
I want to count the number of rows based on multiple columns. Suppose I want to show the number in below df where AgeGroup == "36-45 AgeGroup" and SocioEcnomicStatus =="2". This ...
0
votes
0
answers
22
views
R Studio: 'Object not found' error when calling variable using (df2, var4) instead of (df2%var4) [closed]
I don't understand why calling my variable does not work. I get the error 'Error: object 'var2' not found' when calling the variable by (df2, var4), but not by (df2%var4). Why can't I call it by (df2, ...
-1
votes
0
answers
30
views
I am Trying to import a CSV file but getting the following errors [closed]
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class FrequencyCounter {
...
0
votes
1
answer
17
views
Partitioning on multiple columns?
I'm working a personal project and I have this table called Movies, Formatted as such:
Movie_Title
Genre
Release_Year
John Wick 4
Action-Thriller-Crime
2023
And I split it up by genre into a table ...
0
votes
1
answer
16
views
How can I add the count of a character variable (year) to a barplot figure (with a defined x and y variable) in ggplot2?
I have created this barplot for the total number of cases in a year with each "Year" character representing a single study.
enter image description here
histo$Year <-as.character(histo$...
0
votes
0
answers
17
views
Flutter: Unable to pass Detection Type for count detection, how to pass all 3 types in initPlatformState?
Unable to pass the Detection Type for the handheld device.In our code we do initPlatformState with the following code
Future<void> initPlatformState(DetectionType type) async {
///set the ...
0
votes
2
answers
47
views
Need to create a column that counts values in other columns across rows in dataframe in PySpark
I have following dataframe
Category
Subcategory 1
Subcategory 2
Subcategory 3
Category 1
4
4
6
Category 2
1
0
3
Category 3
0
0
5
I need another column to count for each category number of values ...
-2
votes
0
answers
12
views
make calculations to calculate the number of items and the price of the desired item, in laravel?
I want to make calculations to calculate the number of items and the price of these items, but I'm confused about how because I store the data using foreach in the controller
I'm confused how to make ...
0
votes
0
answers
2
views
ms sql count of sql errors for every day in a month including those with "0"
Trying to get count of sql errors for every day in a month including those with "0".
Tried this:
DECLARE @StartDate DATE = '2023-05-01';
DECLARE @EndDate DATE = '2023-05-31';
WITH DateRange ...
1
vote
2
answers
24
views
Count product combinations which are under same customer
I have table like this:
Customer_nr
Product
11111
Table
22222
Sofa
333333
Table
444444
Closet
11111
Bed
How can I find the number of product combination that a bought by same customer?
Out come ...
1
vote
1
answer
30
views
How to see the duplicates in a different columns in Oracle SQL?
I try to find the duplicates but at the same time be able to see it in a different columns but this duplicates is in the same report and also I verified the duplicates by year.
report
id_tip
date
...
-1
votes
1
answer
21
views
How to create a variable that counts the number of occurrences of another variable (1 for first occurrence, 2 for second etc)
I have this data:
#id time
#1 1
#1 2
#2 1
#2 2
#2 1
#2 2
#3 1
#3 2
And I want to create a variable that looks at the id and time combination and puts a 1 the first time it sees it and 2 the ...
0
votes
0
answers
27
views
rails display one to many
product model
class Product < ActiveRecord::Base
has_many :case_products, dependent: :destroy
has_many :cases, through: :case_products
end
This one works but it gives me the chart for each @...
0
votes
1
answer
25
views
How to sum a count of values in a new column inside a Pivot Table
I want to create a Pivot Table which shows two columns counting specific values of the "Type" Table column
One column counting the "Rec" values
Another column counting the "...
0
votes
1
answer
58
views
rails where and & query .count()
I am trying to count more than one attribute
<%= @user.cases.where(:finished => false) and @user.cases.where(:ready => false) and @user.cases.where(:ship => false) and @user.cases....
-2
votes
1
answer
34
views
How can I group values in arrays and count them in PHP for use in a Highchart?
I have two arrays that contain the value.
$list_partners_edr =
Array
(
[0] => AIDA
[1] => AMAN
[2] => CDS
[3] => CISForm
[4] => ICJ Makassar
[5] => ICJR
[...
1
vote
1
answer
42
views
Count two columns in the same table and then count both as total
Project
project_id
project_name
1
Crispy
2
Smile
3
Genie
Artist
artist_id
artist_name
1
Lisa Simpson
2
John Smith
3
Sally Winter
Credit
credit_id
credit_name
1
Producer
2
Vocalist
3
...
0
votes
2
answers
42
views
How to combine two counts on one table?
The table is like:
country
fruit
size
Japan
Apple
Big
Japan
Apple
Small
Japan
Orange
Big
Singapore
Banana
Small
The expect output is like:
country
type
total
Japan
2
3
Singapore
1
1
I ...
-1
votes
3
answers
59
views
How to remove specific words that are repeated and add a word (if possible) to string
How to remove specific words on a string (and add the word "and" if possible) that are repeated twice but only twice and only certain characters?
Example: "Intruction in seated LE AROM ...
0
votes
0
answers
19
views
Dplyr count not working inside of mutate when counting factors
I'm processing some eye-tracking data and trying to calculate the number of fixations within an area of interest grouped by participant, WHR, BMI and AOI_new. However, I get an error when I attempt to ...
2
votes
5
answers
58
views
Unexpected behavior for count on empty table
I have two tables table_a and table_b in a PostgreSQL 13 database, having UUIDs primary key columns.
table_a has multiple entries, whereas table_b is empty (no entry).
The following query returns the ...
1
vote
2
answers
50
views
Count the non NA value in every 5th column and assign the total count to a new column
I have a dataframe (tibble) with over 3000 rows and over 100 cols. I want to count every 5th columns (e.g., StoZ.x, StoZ.y, StoZ.x.x, StoZ.y.y like that) if any data presence or not. If data is ...
2
votes
5
answers
97
views
SELECT CASE expression, COUNT(*) aggregate to include 0 when no rows match a case
I want a result set that includes all categories and their counts, even if one or more counts are 0.
Table: Numbers
id
number
0
2
1
-1
2
1
What I've tried:
SELECT sign,
COUNT(*) ...
0
votes
1
answer
27
views
Cannot get the group by query to take date into account
Table 1
URI
Date
Name
1
2020-03-05
Fred
2
2020-03-04
Bob
3
2020-03-03
Fred
4
2020-03-02
Dave
5
2020-03-01
Dave
6
2020-02-28
Fred
7
2020-02-27
Bob
8
2020-02-26
Bob
9
2020-02-25
Fred
10
2020-...
0
votes
3
answers
35
views
How to count all posts from a CPT?
My wordpress real estate theme have a custom post type for properties.
Statuses in backend: All, Mine, Published, Draft, Disabled by user
I have a custom field (prop) and I am trying to autocomplete ...
1
vote
1
answer
36
views
SQL select the total number of results in a paginated query with ROWNUM
I would like to figure out if I can select in a single query the total number of results of the query if it wasn't paginated with the ROWNUM values.
My Table is very simple, just these 3 columns (ID, ...
1
vote
0
answers
6
views
get point count after appling filter on layer
i have layer like this with filter on propertice over a source with cluster enabled in mapbox-gl last version, after that i want to cacluate circle redius based on number of features in this cluster ...
0
votes
1
answer
33
views
SQL Query for counting number of times a unique user bought/used product unique
Suppose I have a table like this:
Table Farm
User | Product
1 Apple
1 Orange
1 Apple
2 Grape
2 Grape
3 Apple
4 Orange
3 Grape
2 Apple
I'm relatively a ...
0
votes
2
answers
40
views
Showing the count of checked checkboxes using vanilla javascript
Im currently working on a website that generates a random password. One part of it shows the safety of the current password. Until now i was only able to make the safety-indicator dependent on the ...
0
votes
2
answers
64
views
How can I increase the value stored in count by one every time it is a multiple of 2? [closed]
How can I increase the value stored in count by one every time it is a multiple of 2
I have a function that returns the value of i, it is initialized to 0 and it is auto-incrementing, that is, when i ...
-1
votes
3
answers
45
views
Counting SQL entries
I'm having a hard time counting entries in SQL database. I need to count all entries of the same value in a row. Counting entries in a column down I got no problem with but can't seem to get the row ...
0
votes
1
answer
29
views
count number of occurences in linux directory based on date value
So I have quite a bit of files that I want to to check the file count of based on date, but the thing is dates overlap in the files sometimes. For example a file could look like this
issue_date
...
0
votes
0
answers
21
views
RDP Batch Script with Server List
So, I wanted a simple batch script that calls a servers lists. This makes it super easy to add in new servers as well as provide decent information for newbies when hired on, hence the IP address and ...
1
vote
1
answer
23
views
Getting Count grouped by ID in Pandas
I know their are extensive amount of answers and questions related to count, I just can't find the one I am looking for. I have a dataset about employment history and I need to see How many times the ...
0
votes
1
answer
52
views
Using different conditions for a count in SQL
Hope this question makes sense.
I have a table with a field that has many populated, and many not populated.
I'm trying to get the details of what is and isn't populated (by not populated it could be ...
1
vote
1
answer
20
views
group multiple fields and get respective counts using mongodb
I am having some data:
{
medicationDetails: {
category: 'Asthma',
subCategory: ''
}
},
{
medicationDetails: {
category: 'Diabetes',
subCategory: 'Oral'
}
},
{
...
-2
votes
1
answer
33
views
How can I count the amount of different characters in a string, i.e how many "t, r, u, e" characters are in the string str("true")
Trying to count the amount of certain letters in the word true, what is a simpler way to do this?
I'm hoping for a simpler solution that will give me 4 as an answer!
1
vote
2
answers
45
views
Getting the count of subcategories in a table grouped by categories and subcategories in `SQLite`
I have the following Loans table:
EmployeeId LoanCatId LoanSubCatId LoanDate
------------------------------------------------
1 4 1 19990125
3 3 ...
0
votes
0
answers
20
views
Rolling six month, distinct count, of number of individuals
I am trying to calculate the number of distinct contacts interacted with in the previous six months for each month.
I require to do this for particular organisations and overall.
In layman's terms an ...
-2
votes
0
answers
52
views
Get Total Words from uploaded file based on language selected in Codeigniter
I want to make a function that returns the total number of words from the uploaded file. For example, if I upload a doc file with approximately 13000 words, the function will return 13000 words. Right ...
0
votes
0
answers
21
views
How to count specific words in multiple PDFs and it should be presented in a table using R
I have multiple PDFs. I want to create a table where the frequency of specific keywords are counted and tabulated. I want the output to look like this;
Company name. Year ID. Keyword count
...