Skip to main content

Questions tagged [aggregate-functions]

Aggregate functions are a subset of SQL functions that compute a single value from multiple input rows, mostly used in `SELECT` queries with a `GROUP BY` clause. Practically all modern RDBMS feature aggregate functions. Typical examples include `COUNT()`, `SUM()`, `MIN()`, `MAX()`, and `AVG()`.

aggregate-functions
-1 votes
0 answers
14 views

OTBI Data Model Dataset Join [closed]

I am newly introduced to OTBI due to work (about 2 months ago). I have some SQL knowledge, but I am at a loss on how to join to datasets I have. I want to list my budget and expenses (see screenshot) ...
Tiara T's user avatar
0 votes
0 answers
38 views

How to make aggregate function value a permanent column value?

I have the following query which gives the current_rating value which I am after. However I am wondering how I then make this query update my table permanently so the current_rating value column ...
undecided000's user avatar
0 votes
3 answers
74 views

Update a database table, to remove duplicates, with data from another table

Consider the following two tables. Val1, Val2, and Val3 are combined to make a unique code. These are then tied to "Items" from another table (not depicted here, but only referenced by ...
Michael Kolakowski's user avatar
0 votes
1 answer
26 views

$filter is not allowed or the syntax is incorrect

I have some customers details. The schema is as below: const CustSchema=new Schema({ cust_name:{ type:String, required:true }, email:{ type:String, ...
Soumi Ghosh's user avatar
0 votes
2 answers
46 views

How to use Enumerable.Aggregate without getting CS0411 error

There are two DTO records: public record struct DateHour(int Hour, double? Value); private record struct HourSnapshot(uint TotalSeconds, double? Value); I have another method which works with enum. I ...
Anthony Voronkov's user avatar
1 vote
0 answers
31 views

Creating a custom aggregator in spark with window rowsBetween?

What I'm trying to do is use a window function to get the last and current row and do some computation on a couple of the columns with a custom aggregator. I have time series data with points that are ...
Adrian Corey's user avatar
0 votes
1 answer
19 views

Getting same aggregation value for all category

I have three table named Content, Reaction and ReactionTypes, the Content and ReactionTypes tables are connected to Reaction table using One to Many relationship. Now, Category and Score are the the ...
Penguin's user avatar
  • 21
1 vote
1 answer
57 views

How to order by SUM() DESC when using WITH ROLLUP?

I want to use SELECT WITH ROLLUP in MariaDB to get a summary row in the result set, but also order the remaining rows by SUM() DESC. How to best achieve this? Using the example from the linked ...
Eugene Yarmash's user avatar
0 votes
3 answers
60 views

Mapping result of aggregate function with class in OOP

I have a scenario where I'm designing a class Student. public class Student { int id; string name; string section; int semester; } I have a scenario that I want to display the count ...
user24437316's user avatar
2 votes
1 answer
66 views

Discount accumulated negative sum from column

I have the following dataset in PostgreSQL 15: Generate data SELECT id, value, expected_output, comment FROM (VALUES (1, 0.89, 0.89, ''), (2, 0.17, 0.17, ''), (3, -0.30, 0, 'accum ...
willsbit's user avatar
  • 133
1 vote
2 answers
46 views

Aggregate multiple values in of javascript

I want to reduce an array of objects like this: var data = [{ item: "Item 1", pages: 30, chapters: 3 }, { item: "Item 1", pages: 50, chapters: 3 ...
Ikzer's user avatar
  • 539
0 votes
1 answer
49 views

How to return NaN if all values are NaN using the agg() function specifying aggregation output columns

I have a dataframe like so: data = {'Integers': [1, 2, np.nan, 4, 5], 'AllNaN': [np.nan, np.nan, np.nan, np.nan, np.nan]} df = pd.DataFrame(data) I want to return NaN when performing the sum ...
thentangler's user avatar
  • 1,186
0 votes
0 answers
46 views

Writing query in SQL

I am trying to group a set of data in Google BigQuery and I wrote this query. It keeps bringing out error message. Please, can someone help correct the query or guide me on how to write it correctly. ...
Jolaoluwa Lawal's user avatar
1 vote
4 answers
75 views

How to filter for IDs where another column value is the same for all rows?

I have the following table in PostgreSQL: id fid val -------------------------- 200 995 XXLL 200 996 XXLL 201 995 OOOP 201 996 OOOS ...
user21641220's user avatar
1 vote
1 answer
58 views

Making totals from two queries?

I am trying to calculate the space in a warehouse bin location. I have the following data: Table 1 Bin Location Item Quantity Total Spots Used 000-A-006 ABC1 100 2 ...
Brian Branco's user avatar

15 30 50 per page
1
2 3 4 5
391