How to define AND condition in query design