Skip to main content
The 2024 Developer Survey results are live! See the results

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
0 votes
2 answers
23 views

Polars : output of aggregate function (sum)

When I make the sum of the "Price" column for a subset of rows, I get the correct answer. ca = [df.filter((pl.col('Created') <= datum[j]) & (pl.col('Year') == jaar[j])).select(pl.sum('...
Stefaan Dumez's user avatar
1 vote
2 answers
55 views

SQL filter rows by range overlap

I have a snowflake table that roughly resembles the below. I want to filter out all rows that have the same name, provider and an overlapping voltage range. Before: NAME Provider Min_Volt Max_Volt ...
Joseph Lavelle's user avatar
1 vote
1 answer
50 views

how to calculate the amount?

In postgresql using query WITH RECURSIVE rel_rec AS ( SELECT 1 AS depth, *, ARRAY[lvl] AS child_path FROM types_of_work WHERE parent_id IS NULL ...
dutik's user avatar
  • 27
0 votes
3 answers
52 views

How to return multiple columns based on lowest score in table a, and join to flag eligibility in table b

I am wanting to return for each customer, the column names for the lowest 2 scoring products from Table A but only where the customer is eligible for that product which is indicated in Table B by a 1 ...
J O'Donnell's user avatar
-1 votes
0 answers
18 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
75 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
27 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
58 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
68 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
48 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

15 30 50 per page
1
2 3 4 5
391