

SQL to create histograms - coldclimate
http://wishli.st/blog/creating-histogram-data-using-sql/
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
======
tom_b
A 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 )

------
chrisbolt
Something 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
Hmm, 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.

