Most voted "sum" questions
32 questions
Sort by count of
-
4
votes3
answers902
viewsRETURN THE SUM OF MAXIMUM 3 SQL VALUES
I have a table and I need to return the following: check based on recipient column, add the 3 largest amount of that recipient, bring in query only if the sum of the 3 largest ones are >= 1024:…
-
4
votes1
answer221
viewsMultiplication and summation of dynamic inputs
Note: Developed with Laravel 5.7. Note 2: This is the view from "New Request". The form will dynamically receive the products according to their previously registered items. Until then ok! The user…
-
2
votes1
answer248
viewsSplit sum and Count output in the same Query?
The code below works, but I wanted to know how to do it all query, and if the way I’m riding her is really the best way. $query = Avaliar::select(DB::raw('COUNT(id) as contar'), DB::raw('SUM(nota)…
-
2
votes1
answer214
viewsCount and group by day range
SELECT loc.loc_pac as registro, datediff(dd, pac.pac_nasc, getdate()) as 'dias' from loc with (nolock), pac with (nolock), str with (nolock) where loc.loc_pac <> '' and (loc.loc_pac =…
-
2
votes1
answer30
views$sum returning value 0
I created the database and fill in a 'stock' collection as in the attached figure. I was trying to make the sum of the quantity of items in the stock, but Mongo only returns me the value 0 (zero). I…
-
2
votes4
answers350
viewsHow to add values from a dictionary with arrays by the Python key?
I have the following dictionary: { 'tvmv': [121, 250, 48, 45, 54, 120, 115, 138, 60, 30, 274], 'avic': [358, 60, 40], 'hotels_resorts': [60, 31, 45, 50, 300, 165, 40, 46], 'avani': [70, 40],…
-
1
votes2
answers2225
viewsHow to take the sum of an entire column in SQLSERVER
I need to take the total value of the VOL field (image below), it is already generated by the SUM function. It can be in another query. All periodic tithes are required. ex: total = VOL(7,6890028)…
-
1
votes2
answers683
viewsSum (SUM) of an irregularly formatted column
In my Mysql table I have a column called "weight". This column has the following values: 19.325 14.369 15.325 15.369 17.698 19.258 18.098 I simply need to accomplish the sum, but when I perform…
-
1
votes1
answer56
viewsProblem with the "sum" in Rstudio
I have a problem with the function sum in Rstudio that returns the error attached. I know it is an error that should not occur because it is not from the code. I have already reinstalled Rstudio and…
-
1
votes1
answer283
viewsHow to add values after filtered in Django?
Here’s my loop (in my.html template): {% for item in filter.qs %} <tr> <th scope="row">{{ item.id }}</th> <td>{{ item.nome }}</td> <td>{{ item.data|date:"d, F"…
-
1
votes1
answer23
viewsQuery with two summation results from a condition
I need to perform a query in a table of sold items where there is a Tipoitem field that says if the item is Product(1) or Service(2), I would like it to bring me two SUM’s from one of the Ocisubtot…
-
1
votes2
answers673
viewsHow to sum a column in R
I am using a database with several dates and would like to sum up the values of the last available date, I can filter the data.frame by date, but I can’t make the sum of the values, I’m trying to…
-
1
votes1
answer51
viewsAdd up the total quantity of a product with different batch? SQL ORACLE
Hello! How are you? I hope everyone is well! Guys I’m new in the business and I believe my problem is easy to solve, but I still have no knowledge to solve and from now I thank everyone for the…
-
1
votes1
answer22
viewsAdding Amount of Input per month and customer
Hi, I can’t add up the amount of incoming products per customer per month. Can anyone help me with any tips? I’m getting the following result: MÊS Quantidade 1 95 1 55 2 90 3 140 3 40 3 95 3 40…
-
0
votes2
answers2257
viewsORA-00907: Missing right parenthesis error
I have a select within my query used for summation and every time I add the GRID field of the PA_XCPNT_EVTHST.GRADE table, I get the ORA-00907 error. If I remove the select grid, it works perfectly.…
-
0
votes1
answer520
viewsHow to Join with Sum and Group By
I’m trying to do an SQL search using Join between two tables. The first table is a table containing monthly savings values for a given project. Each time someone registers a project on the site, a…
-
0
votes1
answer49
viewsPostgresql Database
How do I select with sum and inner join to sum an x value between 3 tables. A query to return as few results as possible. create table credit_card ( credit_card_id int primary key, nome varchar (30)…
-
0
votes1
answer213
viewsSum values in a Mysql Count
Good evening, I’m with a doubt I have a system that runs to seguiten query: SELECT IDUsuario ,COUNT('TotalDeUps') as Total, FROM uploads WHERE Time >= '2018-02-20 00:00:00' AND Time <…
-
0
votes2
answers870
viewsAdding total sum grouped to a new column Dataframe pyspark
I have a dataframe with the following columns: COL1 COL2 COL3 NEW_COL* A asd 1 8 B adf 2 9 A adg 8 1 B adh 9 2 C adj 7 7 D adk 1 1 Where NEW_COL = (total sum of col1 by type - the value of col3) /…
-
0
votes2
answers389
viewsSum the value of the column by grouping monthly and by product
Staff I need to calculate the monthly consumption of the licenses used here in the company I work. I have a table with the product (dbo. Product), the number of licenses installed on the server…
-
0
votes2
answers400
viewsAdd to MYSQL query in varchar field by deleting Strings
How to add directly to the query MYSQL when the field is sweep and need to delete some strings. Example: +------------+ |valor_total | +------------+ |R$ 2.277,90 | |R$ 3.217,30 | |R$ 9.857,40 |…
-
0
votes1
answer382
viewsCalculating Larger and Smaller Than Average Returns SQL SERVER Error
In the Columns: SUM(CASE WHEN cqd.queuetime < AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde < Média' e SUM(CASE WHEN cqd.queuetime > AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde >…
-
0
votes1
answer100
views -
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
votes1
answer217
viewsMYSQL - SUM within IF
Good morning guys! All right? I took a look and found nothing about it... If it’s repeated topic, I’m sorry.. Situation: I need to filter the "conditionals" by status, but these status I define from…
-
0
votes1
answer261
viewsI’m getting this error message >>> Typeerror: Cannot read Property 'pop' of null (line 5, "Code" file)
I’m trying in Google Sheets to sum the values of cells that have the same color background. The problem is that the code is returning me the following message: " Typeerror: Cannot read Property…
-
0
votes0
answers122
viewsHow to sum up a field of different classes and different apps?
Hello, I have a class in a Django app called product: class produto(models.Model): descricao = models.CharField(max_length=150) quantidade = models.PositiveIntegerField() valor =…
-
0
votes1
answer401
viewsHow to calculate value + sum(value) within a select
Hello I plan to make a select in that direction: select NUM_PEDIDO, VALOR, ((VALOR/ sum(VALOR)) * 100) as PORC from PEDIDO Obviously this will return me this error: (... is invalid in the select…
-
0
votes0
answers23
viewsConsultation of Total General
I am with the need to build a query where I have the following situation Table 1- Sales [1]: https://i.stack.imgur.com/6GOO7.png In this table I have other vendor codes with other values. I am…
-
0
votes1
answer50
viewsAdd a column where its values are already the result of another sum
I have 2 tables in a database, one contains the purchase orders, another contains the items of these purchase orders, this data is obtained from an import from another system so I do not have…
-
0
votes0
answers67
viewsSum function in SQL database
I need to create a user role (user function) which receives as input parameters a store identifier code and a category identifier code and returns as a result an integer value that informs the…
-
-2
votes1
answer332
viewsHow to format sum() output in Python dataframe
I would like to format the result of sum(). When I use the following command: # Valor concedido de aposentadoria por ano df.groupby('Ano')['Vlr Benefícios Concedidos (R$)'].sum() It returns me the…