Most voted "count" questions
81 questions
Sort by count of
-
0
votes1
answer41
viewsReturn amount of dependents per employee
I need to select the Plate, the Employee Name and the Number of Dependents of each Employee, but the result of this query is showing the amount of dependents only for the first employee, and I need…
-
0
votes1
answer293
viewsSelect com group by duplo
In Mysql I have a table called contact_status: id | id_contato | detalhamento_id 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 2 | 2 5 | 2 | 1 6 | 3 | 2 7 | 4 | 4 8 | 5 | 4 In it is recorded all the contacts of…
-
0
votes3
answers91
viewsHelp with SQL query with COUNT in multiple rows
Hello, I’m doing the following consultation SELECT p.id, c.nome, v.titulo, count(v.titulo) FROM passageiros AS p LEFT JOIN clientes AS c ON c.id = p.id_cliente LEFT JOIN viagens AS v ON v.id =…
-
0
votes1
answer100
views -
0
votes2
answers40
viewsUsing formula in SQL
Hello, I’m having a doubt and I can not find examples to progress, following: select 'disponivel' as TIPO , COUNT(distinct dp.ds_nome) as qtd FROM dm_pessoa_treino dp union ALL select 'em_uso' as…
-
0
votes0
answers64
viewsHow to use two Join followed SQL
How can I use two joins in a row, and the second will use the table data generated by the first? I want it to relate the Join by the same data, where in the first Join it unites the data of table A…
-
0
votes0
answers45
viewsCount number of Users
I have a Client class, and a Systems Class. A customer has one or more systems: public class ClienteEmpresa : Pessoa { public virtual ICollection<TipoDeSistemas> TipoDeSistemas { get; set; } }…
-
0
votes1
answer510
views -
0
votes1
answer331
viewsSelect mysql with COUNT and GROUP BY MONTH
Hello, I am trying to put together the information of two tables to generate a graph, I need to count the total of record consults1 and consults2 and group by month: Currently I have this return:…
-
0
votes1
answer260
viewsMultiply two columns in a select With Groupby
How Can I Do This Multiplication? the table looks like this: What has to be done is to group disciplines 11 and 13, count how many 'sit' F and Null have and multiply by 'qntd_aula'... I managed to…
-
0
votes1
answer207
viewsDisplay variable only once on a foreach and count total rows of an IF
I have a script, which basically compares the files of a bank table with the files of a directory, and it shows the files that are NOT in the database and are in the directory. I have 2 problems:…
-
0
votes1
answer62
viewsCount occurrence of events traversing columns of a dataframe through a for loop in R
Hello, I am using the table() function of R to count the repeated notes in each semester column (sem1, sem2,sem3...) of my file. It’s working properly, but I’d like to do it through a loop for and…
-
0
votes1
answer282
viewsHow to make a cumulative sum in Bigquery?
Hello. I need to create a Dashboard from a query. I would like to generate this column in the query always adding up to the previous month, ie a cumulative sum. ex: instead of: mês 1: 2 mês 2: 3 mês…
-
0
votes1
answer48
viewsError doing Count on Join
I’m having difficulties in an issue where my codes always go wrong. The question is: Select the customer name and the number of phones they have registered classified in descending order by the…
-
0
votes2
answers40
viewsConsultation with Count
I have the following table : Product status SELECT id_produto_status_history, status, description, create_date, id_produto FROM produto_status_history; where I store product history status There is…
-
0
votes0
answers42
viewsHow to unify the results of Count POSTGRES
Good morning, I need this query to return the unified result, different from what it returns to me, does anyone have any idea how to do this in Postgres?? went until May(May) but continues until the…
-
-1
votes1
answer51
viewsSelect with most messaging users
I’m making a system and I have to know which user sent the most messages. My tables are more or less like this: User id|nome|sobrenome|email| ... Messages id|uid|nome|email|assunto|msg| ... I just…
-
-1
votes1
answer123
viewsHow to give Count up to a limited value, "countar up to 90 on a table that has 100"
I assembled the following Query - "INFORMIX" SELECT COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90); Which returns me the following error: An error occurred when executing the SQL command:…
-
-1
votes1
answer169
viewsHow to know the number of films by categories that have less than 50 films?
I have a movie chart with: -id_film, -movie name, -id_category; And another category with: id_category, category name; how do I select only the category and amount of films of those that have less…
-
-1
votes1
answer213
viewsHow often a string appears in a table in each record (SQL Server)
I have a table in SQL with a column called "content", varchar . This column stores the contents of Xmls. I need to count the number of times a certain word (tag) is in each XML, ie for each record…
-
-1
votes1
answer87
viewsLaravel Mysql - display the amount of records in a Join query
I have the following query: $empresas = DB::table('empresas') ->join('departamentos', 'empresas.id', '=', 'departamentos.empresas_id') ->join('eventos', 'eventos.departamentos_empresas_id',…
-
-1
votes1
answer81
viewsCOUNT + JOIN WITH DIFFICULTY IN RESULT
I need to get two results... I have a table with a total of 102 drivers and another table with the date he left to make deliveries and another with the arrival date... I need to know which drivers…
-
-1
votes1
answer39
viewsMYSQL VIEW data listing
I made a view that lists me a record count in Day, Week, Month and Year, but when I add new records the Day record doesn’t just change the others. Follow the code of the day: SELECT COUNT(id) FROM…
-
-1
votes2
answers71
viewsThe correct way to count an array in PHP
I would like to ask a question, I have a script where I count the total of files of a directory and compare with the files of the bank, everything is working. My question is this:: When I put a code…
-
-1
votes1
answer28
viewsQuestions with COUNT/GROUP BY
Good afternoon, I’m having trouble with the group by clause. I have a gigantic query, I need to quantify the contracts by Id, showing the degree of impact. Then I gave a Count(Id). The problem is…
-
-1
votes1
answer82
viewsCount a pl/sql column
I am trying to count a column (minutes) as it is in the query: SELECT distinct b.nr_atendimento ,to_char(dt_prescricao,'dd/mm/yyyy hh24:mi:ss') Prescricao ,to_char(a.dt_atualizacao,'dd/mm/yyyy…
-
-2
votes1
answer1420
viewsShow Mysql query result with Echo (PHP)
I have a script in PHP and Mysql that has a query responsible for counting how many records (clients) are inserted in one of the tables of my database. However, I need to show the amount of records…
-
-2
votes1
answer63
viewsSelect COUNT > 10K in C# and SQL
I would like to select in records greater than 10 thousand and delete after. select count (FuncionarioID) > 10000 FROM FuncionarioLog; How should I select correctly?…
-
-2
votes0
answers43
viewsQuery of SQL Count
In a certain algorithm routine, the following data is recorded in a table: Color Changed Led (Are two possible leds, code 2 to yellow, 3 to red) Reason for the Change (These are pre-defined reasons…
-
-3
votes1
answer68
viewsHow to unify the results of Count POSTGRES?
Good morning, I need this query to return the unified result, different from what it returns to me, does anyone have any idea how to do this in Postgres?? went until May(May) but continues until the…
-
-4
votes1
answer51
viewsHow can I get this code to display the first 100 even numbers not multiples of 10?
#include <stdio.h> #include <conio.h> int main () { int count; for (count=0;count<200;count=count+2) printf ("%d \t ",count); if (count%10==0) { count++; } getch(); return(0); }…