fix #49 sql query modified by appending group by