Almost correct query return result