Questions tagged [aggregates]

Aggregate functions, typically found in SQL, derive summary values from multiple rows in a single column.

An aggregate, more commonly known as an aggregate function, is a means to examine the values found in multiple rows from a single column. These are grouped together as input on certain criteria to form a single value of more significant meaning or measurement, such as a set, a bag or a list. Aggregates are usually found in SQL.

179 questions
0
votes
2 answers

How to get last transaction of every account using aggregates Or Queries in Outsystems?

I'm having Accounts entity and Transactions entity. Here one Account can have multiple transactions. My Question is, How can I get The last transaction of each account by using aggregates Or Query in Outsystems.?
aravind
  • 15
  • 7
0
votes
1 answer

Using TSQL to UNPIVOT simple aggregated totals...is this even possible?

I was trying to perform a simple un-pivoting of some data before it is loaded into Microsoft PowerBI. Since the PowerBI report has to use DirectQuery, using 'Unpivot' in the query editor is not an option. So it seemed that this could probably be…
0
votes
1 answer

How do I narrow a group of Postgres rows by which has values closest to specific values?

I have some data which looks something like this after I run some filters on it: Business Type | Business City | Min Rating | Max Rating --------------+---------------+------------+----------- Restaurant | Barcelona | 2 | …
Brandon
  • 1,735
  • 2
  • 22
  • 37
0
votes
1 answer

MS-Access, Continuous form of multiple clients - Form.Text field containing Last Communication for Each Client / Customer in List

I am a First time user of StackOverFlow here! I have been trying to figure this out for two days and have come up short. We have a form that displays every single Client / Customer that we have at the firm, in a continuous form view. We want to be…
0
votes
1 answer

Can tfdquery.aggregates be used as autoIDgenerator

In Delphi the TFDQuery component has a property "aggregates" which represents a lightweight version of client side aggregate fields to Data Sets. If you insert "MAX(ID)" you get a number that is one less than the next free number of the ID. If this…
0
votes
1 answer

Mondrian / Saiku - Aggregate tables not used by SqlTupleReader

We are trying to improve the performance of a Saiku analytics server. For this, we have created aggregate tables at different granularities so that Mondrian can make use of them and retrieve the results faster. While analyzing the logs, we have…
0
votes
1 answer

MongoDB aggregate query adding to pipeline causing no results

I'm running an aggregate through PyMongo. The aggregate, formatted fairly nicely, looks like this: [{ $match: { syscode: { $in: [598.0] }, date: { $gte: newDate(1509487200000), $lte:…
Dylan Brams
  • 2,089
  • 1
  • 19
  • 36
0
votes
1 answer

SSRS calculating linear trends for groups

Suppose I have a dataset with values like this: Date A B C D 1/1/2017 0.67 0.87 0.34 0.77 2/1/2017 0.76 0.76 0.55 0.70 3/1/2017 0.83 0.83 0.56 0.67 4/1/2017 0.90 0.79 0.49 …
basaquer
  • 3
  • 1
0
votes
4 answers

SQL: Taking Column From a Row Picked By Aggregate Function in View

I have three SQL tables: Release (which represents a release of a movie), Media (which represents the individual pieces of recordable media in those releases; i.e. for Blu-ray/DVD combos, there will be two rows in Media, one Blu-ray and one DVD,…
Superfield
  • 25
  • 1
  • 8
0
votes
2 answers

T-SQL Conditional Max or Sum based on group criteria

I have not been able to figure this out and I want to find out the most efficient way of doing this. I have this table (partial records shown): prefix FolioNumber CmmtAmount CmmtNumber ------- ----------- ---------- ---------- 100981 …
cheluto2
  • 35
  • 6
0
votes
1 answer

SQL - select rows until aggregate is matched

I have a table of packages. Each packages has a priority and weight: priority | weight ----------------- 1 4 2 3 3 5 4 1 5 3 I want to fit all packages, sorted by priority, into a box, until the maximum…
Jake P.
  • 3
  • 2
0
votes
1 answer

Optimizing an SQLite max() query

I have a table with some hundred million records, with about 15 different columns. The data is among others speed recordings, with a timestamp, an id on the vehicle that is tracked and a speed recording. A single vehicle can have hundreds of…
bjornasm
  • 2,211
  • 7
  • 37
  • 62
0
votes
2 answers

How to roll up based on a few criteria in SQL

I have a data table like this: QuestionID UserName UserWeightingForQuestion AnswerGivenForQuestion Metric 1 A 1.50 1 ToBeCalculated 1 B 1.00 …
user1330974
  • 2,500
  • 5
  • 32
  • 60
0
votes
1 answer

sql - need clarification "q.type" on crosstab/aggregates for average/min/max

It's a follow-up question for my previous question:sql - min of 9 weeks max of 15 weeks average of 16 weeks I'm getting "Enter parameter value of q.Type" when I execute parfait's awesome answer. Can someone explain why and how can I…
John Tipton
  • 185
  • 3
  • 11
0
votes
2 answers

Building a string based on columns from a GROUP

I have a table like this: user 1 A user 1 B user 2 H user 2 G user 2 A and I need a result like: user 1 AB user 2 HGA Is there a way to obtain a result like this?
Judit
  • 3
  • 3