3 ms·
SQL to create histograms
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
- chrisbolt 16y agoSomething tells me that query would probably run faster if written as a join, especially in MySQL. Also, what's the point of a section of the same content in the article being repeated in a larger font to the left?
- coldclimate 16y agoHmm, you're right it would probably run a bit faster as a JOIN, I just default to using subqueries by nature. Re:Theme with massive paragraph - it was based on a magazine wordpress theme and we're yet to edit it down.
- tom_b 16y agoA little flaky perhaps, but if you're gonna love sql :-) select distinct cnt, count(cnt) over (partition by cnt) from ( 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 )