This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: Best SQL Crime Ever
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
select u from ( select @ac:=0 i, NULL u union select * from ( select 0,
concat('http://chart.apis.google.com/chart?cht=pc&chd=t:',
group_concat(100*(q/@ac)),'&chl=',group_concat(l
separator '|'),'&chs=300x200') u from ( select q, l, @ac:=(@ac + q) from (
select sum(d)q, l from( select @s:=((select min(end_time) from delta)) d,
(select min(end_time) from delta) st, 0 l union select (end_time-@s) d,
(@s:=(end_time)), level from delta order by st)x group by l having (l is not
null and l > 0)) e ) r) m) pp order by u desc limit 1