Filling out query and condition