Implement querying with logical AND