Fix dimension only query with where condition