http://www.cnblogs.com/meslog/archive/2010/01/15/1648707.html

SQL code