I'm trying to query a table in Drill and return a result set that combines
grouping with the granular rows such that the rows for each group has a
summary row.  Is there anything in Drill that supports returning a summary
row for each group of returned rows?

For example, imagine a sales table with employee, sale_amount columns.

/* get all sales */
select employee, sale_amount from sales;

/* summarize sales by employee */
select employee, count(*) `count`, sum(sale_amount) total from sales group
by employee;

/* results with a summary row for each data row */
employee, count, total
Frank, 29, 1000000      // summary row for employee 1
Frank, , 100000            // first data row for emp 1
Frank, , 100000            // second data row for emp 2
Mark, 10, 500000         // summary row for employee 2
Mark, , 100000             // first data row for emp 2
...

Thanks,
Minnow

Reply via email to