Skip to content

Instantly share code, notes, and snippets.

@revilon1991
Created January 23, 2024 09:13
Show Gist options
  • Save revilon1991/827b5232d2eadaededce3229061cd8c4 to your computer and use it in GitHub Desktop.
Save revilon1991/827b5232d2eadaededce3229061cd8c4 to your computer and use it in GitHub Desktop.
# Majority Grouping
select concat(repeat('*', floor(a.trCount / 100))) as bar,
floor(avg(a.trCount)) as avgTrCnt,
max(a.trCount) as maxTrCnt,
min(a.trCount) as minTrCnt,
count(*) as accountCnt
from Account a
where 1
and a.trCount > 10
group by bar
order by bar
limit 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment