changed the sql query