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

SQL average not working as I expected

Below is my SQL Query... My Averages however are not averaging the totals, but rather just displaying the SUM. I am not sure why though. Can anyone provide any insight? SELECT AVG(a.t1) as '8:00-9:00', AVG(a.t2) as '9:00-10:00', AVG(a.t3) as…
0
votes
1 answer

Conditionals and Aggregates across Multiple Tables

I have table that looks like the following: `units` +----+------+-------+---------------+-------+ | id | tech | jobID | city | units | +----+------+-------+---------------+-------+ | 1 | 1234 | 8535 | San Jose | 3 | | 2 | 1234 |…
0
votes
1 answer

Cypher diverging and converging path aggregate

I have a question regarding aggregates over multiple paths that converges and then diverges again. Some of the aggregates should then take only a subset of the paths into account, while others more. I'll explain this as best I could using an example…
superkruger
  • 369
  • 4
  • 10
0
votes
3 answers

Sql query to compare the result between multiple records and provide a result

I need to write a query that will result with a "fail" condition when one test fails. Testing results are listed in the Fail and Pass columns. One manufacturer product can have many tests. My Data is like this: MFG Name | Code | Breaker | Fail |…
joeldub
  • 57
  • 1
  • 10
0
votes
2 answers

How can I model a template-like entity in DDD?

I am a beginner with DDD and I try to model elegantly in C# the next scenario: A template that basically has only a name property on it and a list of items that have to be executed in a specific order. public class Template { public string…
Gradinariu Cezar
  • 553
  • 1
  • 5
  • 12
0
votes
2 answers

SQL OVER(Partition) issue - selecting a subset

I'm trying to get a specific subset of data using "over(partition)" syntax. I've created sample data to illustrate. Running the following CTE results in the a small example result set. I need to calculate 2 date ranges using the following…
Sworck
  • 21
  • 1
  • 1
  • 4
0
votes
1 answer

How to see which SQL Columns are groupable

I am writing a log analyzer tool that provides a list of tables to query dynamically. Then, for each table, I want to allow the user to run a select query where they group based on certain selectable columns. The challenge? Figuring out…
0
votes
1 answer

struggling with SQL aggregate function

I have a table containing weights over time which I want to evaluate as flow: Scan TimeStamp Position Weight 01 14/11/01 12:00 0 0 01 14/11/01 12:10 10 1.6 02 14/11/01 13:00 0 2.6 02 14/11/01…
llnck
  • 1
  • 1
0
votes
1 answer

Getting a seperate/minimum value of another column, of an aggregate in MYSQL

I have this query, which retrieves aggregates of all my leads based on leadtype, then groups them into cities. SELECT city, assign_count, SUM(leadtype = 'paper' AND status='NEW' ) paper, SUM(leadtype = 'door' AND status='NEW' ) door …
Kylie
  • 11,421
  • 11
  • 47
  • 78
0
votes
1 answer

Cache table versus query on full table

I have a table named 'calls' with about 1,000,000 rows so far. Every day new calls are made, and I provide an aggregate daily stat, looking at todays calls only. So a sum of all calls made today, grouped by their status. My question is... Is there…
Kylie
  • 11,421
  • 11
  • 47
  • 78
0
votes
1 answer

SQL filtering by aggregate functions

Suppose I have an Employee table and a Department table. Every employee has one department. Now, suppose I want to see all the departments --along with the employees of those departments-- that have exactly 1 employee. Let's say my database looks…
nckbrzg
  • 474
  • 6
  • 15
0
votes
2 answers

logarithmic time count(*) range query on any DBMS

Suppose there is a table T, with column C indexed by a B-tree, and a given constant k. Assume the result of the following query would be n: select count(*) from T where C > k; I tried such a query in MySQL(InnoDB) ,with column C indexed by B-tree,…
Hamid Alaei
  • 406
  • 4
  • 16
0
votes
0 answers

ASP.NET MVC & Kendo UI Grid aggregates

I am trying to get a sum of all "TransactionAmount"s in the kendo grid I have created. I have the following code and I am getting a JavaScript error saying the 'sum' is undefined. Could you please tell me what I am doing wrong? <%:…
user317891
  • 23
  • 1
  • 6
0
votes
2 answers

Python: Aggregate data for different users on different days

I'm a new Python user and learning how to manipulate/aggregate data. I have some sample data of the format: User Date Price A 20130101 50 A 20130102 20 A 20130103 30 B 20130201 40 B 20130202 20 and so on. I'm…
user1661244
  • 121
  • 1
  • 3
  • 6
0
votes
0 answers

Using CalculatedMembers in Aggregated tables with mondrian 2.4.2

I'm trying to set up custom aggregated tables in our mondrian data warehouse. I defined the custom aggregated table like this:
Tamas Rev
  • 7,008
  • 5
  • 32
  • 49
1 2 3
11
12