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
2
votes
1 answer

pandas dataframe.describe() obtain aggregates based on index values

I am trying to use the .describe() method on df1 to obtain aggregates. The current index is year. I want to obtain these stats based on each statistics over the 3 year period in the index. I tried using stats_df =…
Morello
  • 258
  • 2
  • 10
2
votes
1 answer

How can I generate Query in elastic search for multiple boolean queries

I want to generate query for multiple boolean operation dynamically in elasticsearch with spring framework. my data in elasticsearch is like { "masterID" : "" "processedData": [ { "string_value": "22", …
2
votes
1 answer

Is correct to have an aggregate with fields different than database object?

I'm trying to apply DDD and I have some doubts. I'm reading Scott Millet DDD book and I've just read Aggregates chapters. Imagine a simple domain model like this: class Candidate val id: CandidateId val name:Name val musicStylesPreferences:…
Arturo
  • 21
  • 2
2
votes
1 answer

Simple aggregate query running slow

I am trying to determine why a fairly simple aggregate query is taking so long to perform on a single table. The table is called plots, and it is [id, device_id, time, ...] There are two indices, UNIQUE(id) and UNIQUE(device_id, time). The query is…
valenumr
  • 85
  • 5
2
votes
0 answers

Sumarize column using TAggregatefield with distinct index of Firedac query in Delphi

I'm using Delphi XE5 and i have a firedac query (FDQuery) with three columns: (Account, value, Vendor) and i need sum the value field per Account on TAggregateField. The same account can have many vendors. Account | Value | Vendor 1 | 100.00|…
AnselmoMS
  • 467
  • 3
  • 18
2
votes
1 answer

Php MongoDB aggregation with match and sort order

I use this query in Mongo Shell to get the elements of the array 'events' in order by the value of 'start' field db.collection_name.aggregate( { $match: { _id : ObjectId("59941bec47582c1e92b93c9b") }}, { $unwind: '$events' }, { $sort: { …
user3860585
2
votes
3 answers

How do I represent Domain Aggregates in MVC pattern?

SHould I create a separate class for each object in an aggregate or should the objects be nested classes of a single aggregate class?
zsharp
  • 13,656
  • 29
  • 86
  • 152
2
votes
1 answer

How not to use wildcards to avoid duplicate column names when joining

This is what I desire (ROQ & Trigger column can be blank) This is Query 3 that I want to Join to this Join query. I have tried but the column doesn't look like Query3. SELECT t1.*, t2.*, t3.* FROM CrossTab1 t1 INNER JOIN CrossTab2 t2 ON…
John Tipton
  • 185
  • 3
  • 11
2
votes
1 answer

Aggregate column text where dates in table a are between dates in table b

Sample data CREATE TEMP TABLE a AS SELECT id, adate::date, name FROM ( VALUES (1,'1/1/1900','test'), (1,'3/1/1900','testing'), (1,'4/1/1900','testinganother'), (1,'6/1/1900','superbtest'), (2,'1/1/1900','thebesttest'), …
James Steele
  • 645
  • 1
  • 6
  • 22
2
votes
1 answer

Aggregate based on Array value

I have collection schema like : { "_id" : ObjectId("582ee289618a504e5c830e03"), "updatedAt" : ISODate("2016-11-24T05:01:59.470Z"), "createdAt" : ISODate("2016-11-18T11:14:17.912Z"), "requestId" : "IER5R2H", "pickupDetails" : { "_id" :…
Sachin Bhandari
  • 524
  • 4
  • 19
2
votes
1 answer

Grouping sets columns in aggregate arguments and NULL replacement

There are many grouping sets examples on the internet like query Q1 in the example below. But query Q2 is different because A2 is a grouping column and it is used as the argument to SUM(). Which one of the following is correct for Q2 according to…
Ben C
  • 658
  • 6
  • 18
2
votes
0 answers

Django Aggregates Across Reverse Relationships

This is related to this question, however it is slightly different. For simplicity, say I have the models (using Django 1.7): class TimesheetEntry(models.Model): date = models.DateField() employee = models.CharField(max_length=255) hours…
Cortez1138
  • 55
  • 6
2
votes
2 answers

Group by binary operator in PostgreSQL

I'm using PostgreSQL 9.2.4. Question I have a table with an ID and a second column of some type. Let's call the type X. I also have a binary function that operates on a pair of Xs and returns a boolean. We'll call this function f. f is transitive;…
jpmc26
  • 28,463
  • 14
  • 94
  • 146
2
votes
1 answer

Considering the following architectural changes and need some advice (Domain Entities, DTO, Aggregates)

about a year ago I set set up a solution consisting of an ASP.Net MVC 3 (now) presentation layer, application layer, domain layer and infrastructure layer (crosscutting stuff and data). I decided to keep the domain model in a separate project from…
2
votes
3 answers

Getting Additional Data for a Domain Entity

I have a domain Aggregate, call it "Order" that contains a List of OrderLines. The Order keeps track of the sum of the Amount on the Order Lines. The customer has a running "credit" balance that they can order from that is calculated by summing the…
jlembke
  • 13,217
  • 11
  • 42
  • 56
1 2
3
11 12