modify sql server 2012 , add subquery support