Report TOTAL functionality

sansql's profile image sansql posted 2 years ago in General Permalink

Hello all, is there a way or if not (can this be a feature request) as to when doing SQL queries, to have an easy option to create a TOTAL's row and apply some simple rules like sum/count/avg on entire column.

Imagine you're selecting like

select category, product, count (*), sum (revenue) from orders group by category, product

and then add something like

SHOWTOTALS ('TOTAL', null, sum, sum)

that would then will add a TOTAL row applying either string, null for empty, or operation.

So the example above would have TOTAL as first column, then blank, and then sum of products and sum of total revenues.

Alternative to this is to do an union with duplicating queries and changing output using same colums, but it means double the work whilst it could have been done potentially with a simple one liner.

This wild allow heidi SQL to be a bit of a data BI tool and save a lot of time and also reduce errors.

1 attachment(s):
  • hei_sql

Please login to leave a reply, or register at first.