---
title: "Comment by Joe Kerr on \"Writing Fast Queries in APEX\" | Hashnode"
description: "I am trying to implement this with a more complicated query. Thoughts on a where clause like this, or one using between and dates? ( VW_Person.Person_Number = :"
url: "https://hashnode.com/posts/writing-fast-queries-in-apex/67dd8f8b5b905023af864ac2/comment/67e847f87c8e2b9bf7fcf6cd"
---

[Discussion](https://hashnode.com/posts/writing-fast-queries-in-apex/67dd8f8b5b905023af864ac2)

Comment [Writing Fast Queries in APEX](https://hashnode.com/posts/writing-fast-queries-in-apex/67dd8f8b5b905023af864ac2)

[Joe Kerr](https://hashnode.com/@jkerr)

[Mar 29, 2025](https://hashnode.com/posts/writing-fast-queries-in-apex/67dd8f8b5b905023af864ac2/comment/67e847f87c8e2b9bf7fcf6cd)

I am trying to implement this with a more complicated query. Thoughts on a where clause like this, or one using between and dates? ( VW\_Person.Person\_Number = :APP\_PERSON\_PERSON Or :APP\_IS\_ADMIN = 'Y') And ( :P21\_CRITERIA\_STATUS = 'A' AND STATUS\_TRAN\_PERSON = 'ACTIVE' OR :P21\_CRITERIA\_STATUS = 'I' AND STATUS\_TRAN\_PERSON = 'INACTIVE' OR :P21\_CRITERIA\_STATUS NOT IN ('A', 'I')) And (:P21\_CRITERIA\_EPRGENRL\_ID IS NULL OR Employer\_ID = :P21\_CRITERIA\_Employer\_ID); Note: Criteria\_Status is a group letting the user select (A)ctive, (I)nactive, or Al(L) people. Thanks Joe
