Trim query.