Working query in view