question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Group by aggregation for table joins

See original GitHub issue

Use case: Being able to aggregate data across multiple tables and grouping by certain fields.

Feature description: Let’s say I have two tables: tableA, tableB. tableA contains all of my metadata and tableB contains important timing information relevant to a record in tableA.

For example: tableA contains the following columns:

id STRING,
browser STRING,
browserversion STRING,
os STRING

tableB contains the following columns:

testid STRING,
testname STRING,
startdate LONG,
enddate LONG,
time STRING

Example query:

SELECT avg(tableb.time), tableb.testname FROM tableb INNER JOIN tablea on tableb.testid = tablea.id GROUP BY tableb.testname;

Error that I currently get:

ValidationException[GROUP BY on JOINS is not supported]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
mfusseneggercommented, Apr 20, 2017

We’ve merged support for GROUP BY on joins via https://github.com/crate/crate/pull/5339 - it’ll be part of the next feature release (1.2)

3reactions
RichardLindhoutcommented, Mar 6, 2017

What is the status on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

An Introduction to Using SQL Aggregate Functions with JOINs
Powerful SQL tools. Let's see how they cooperate paired with LEFT JOIN, SUM and GROUP BY perform computations on multiple tables.
Read more >
Join tables with Aggregate value - sql server - Stack Overflow
Try this one - SELECT a.Name , Value1 = ISNULL(Value1, 0) , Value2 = ISNULL(Value2, 0) FROM ( SELECT Name , Value1 =...
Read more >
SQL join tables with group by and order by - w3resource
In this page, we are going to discuss the usage of GROUP BY and ORDER BY clause within a join. Example: Sample table:...
Read more >
Working With Joins, Aggregations, and Built-In Functions
Joins are the mechanism used to link tables in a dataset together for the duration of a query so that related data in...
Read more >
A Practical Approach to Groupjoin and Nested Aggregates
c_id. GROUP BY cust.id. In a traditional implementation, we answer the query by building two hash tables on the same key, one for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found