Finetuned SQL script

http://www.pcmag.com/article2/0,2817,2369981,00.asp