Skip to content Skip to sidebar Skip to footer
Showing posts with the label Aggregate

Sql Server : How To Use An Aggregate Function Like Max In A Where Clause

I want get the maximum value for this record. Please help me: SELECT rest.field1 FROM masterta… Read more Sql Server : How To Use An Aggregate Function Like Max In A Where Clause

Error When Calculating A Running Total (cumulative Over The Previous Periods)

I have a table, let's call it My_Table that has a Created datetime column (in SQL Server) that … Read more Error When Calculating A Running Total (cumulative Over The Previous Periods)

Sql Join, Group By On Three Tables To Get Totals

I've inherited the following DB design. Tables are: customers --------- customerid customern… Read more Sql Join, Group By On Three Tables To Get Totals

Generating A Subquery With Arel To Get An Average Of Averages

Lets say I have a few of tables orders = Arel::Table.new :orders stores = Arel::Table.new :stores m… Read more Generating A Subquery With Arel To Get An Average Of Averages

Product Aggregate In Postgresql

I try to create an aggregate for product (*) in PostgreSQL. The field type of my row is 'double… Read more Product Aggregate In Postgresql

Postgresql: Subgrouping Column Based On Intervals

I have the following tables: SELECT * FROM trajectories LIMIT 10; user_id | session_id | … Read more Postgresql: Subgrouping Column Based On Intervals

What's The Fastest Way To Obtain The Maximum Value Of A Column In A Table?

INFORMIX-SQL 4.10.DC1 (SE Engine), on DOS 6.22, under Microsoft Virtual PC 2007, in Windows 7! EDIT… Read more What's The Fastest Way To Obtain The Maximum Value Of A Column In A Table?

How Can You Find The Rows With Equal Columns?

If I have a table with important 2 columns, CREATE TABLE foo (id INT, a INT, b INT, KEY a, KEY b); … Read more How Can You Find The Rows With Equal Columns?

Postgresql - Order By An Array

I have 2 tables - course that contains id and name of the courses and tagCourse that contains tags … Read more Postgresql - Order By An Array

Group Records By Time

I have a table containing a datetime column and some misc other columns. The datetime column repres… Read more Group Records By Time

Distinct Listagg That Is Inside A Subquery In The Select List

Here is a minimal working example of what I'm trying to do and what I'm getting: I have a q… Read more Distinct Listagg That Is Inside A Subquery In The Select List

How To Load Extensions Into Sqlite?

I need a standard deviation function in SQLite. I have found one here: http://www.sqlite.org/contr… Read more How To Load Extensions Into Sqlite?

Sql - Consolidate Overlapping Data

I have a simple data set in SQL Server that appears like this **ROW Start End** 0 1 … Read more Sql - Consolidate Overlapping Data

Sql: Use Lead() And Partition By To Access To The Next Row Following The Current Row

I have a mobile app browsing history dataset as shown below. DeviceDateTime: Date and Time the Use… Read more Sql: Use Lead() And Partition By To Access To The Next Row Following The Current Row

String Aggregation In Oracle 10g With Three Columns

This is a sample table data Date | Fruit | Number ----------------------- 1 | Apple | 1 … Read more String Aggregation In Oracle 10g With Three Columns

Preserve The Order Of Distinct Inside String_agg

My SQL function: with recursive locpais as ( select l.id, l.nome, l.tipo tid, lp.pai from l… Read more Preserve The Order Of Distinct Inside String_agg

Preserve The Order Of Distinct Inside String_agg

My SQL function: with recursive locpais as ( select l.id, l.nome, l.tipo tid, lp.pai from l… Read more Preserve The Order Of Distinct Inside String_agg

Do All Groups Have Equal Total Power For Given Subgroup?

I have a PostgreSQL table like this: CREATE TABLE foo (man_id, subgroup, power, grp) AS VALUES … Read more Do All Groups Have Equal Total Power For Given Subgroup?