TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

SQL to create histograms

6 pointsby coldclimatealmost 15 years ago
There's nothing really complicated about it, but I didn't find a good example online anywhere, so when I figured it out, it was time to share it

2 comments

tom_balmost 15 years ago
A little flaky perhaps, but if you're gonna love sql :-)<p>select distinct cnt, count(cnt) over (partition by cnt) from (<p>select 'a' usr,1 cnt from dual union select 'b' usr,1 cnt from dual union select 'c' usr,2 cnt from dual union select 'd' usr,3 cnt from dual union select 'e' usr,3 cnt from dual )
chrisboltalmost 15 years ago
Something tells me that query would probably run faster if written as a join, especially in MySQL.<p>Also, what's the point of a section of the same content in the article being repeated in a larger font to the left?
评论 #1374151 未加载