Query problem solved