Database query is adding unwanted dates

I am trying to run a gift query on two specific funds for this calendar year. I have the funds listed in the criteria and this calendar year as the gift date. It keeps pulling older dates as well. I have tried to use <ask>, between, and equals- All of which return the same results. My Output has Name, Gift Amount, and Date. What am I doing wrong? I found the workaround, by pulling the gift list in webview and then making the changes I needed in database view, but shouldn't this query work in database view?

Comments

  • JoAnn Strommen
    JoAnn Strommen Community All-Star
    Tenth Anniversary Kudos 5 March 2026 Challenge: Answered Questions January 2026 Monthly Challenge

    @Melissa Duffy It would be helpful if you could share a screenshot of your query criteria.

    Are you using ( ) around the funds with an OR condition?

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Kudos 5 Facilitator 4 bbcon 2025 Attendee Badge

    @Melissa Duffy
    yea you need some paranthsis for the logic to work properly.

    What you currently have is basicaly saying: give me any gift that is between 1/1/2024-10/16/2024 and have fund id 16. OR fund id 21 without criteria on gift date.

    instead you need to put open paranthesis on fund id 16 and close parantheiss on fund id 21

    gift date between 1/1/2024-10/16/2024

    AND ( fund id equals 16

    OR fund id equal 21 )

    ------------------------

    OR you can just do

    gift date between 1/1/2024-10/16/2024

    AND fund id one-of 16 , 21

  • JoAnn Strommen
    JoAnn Strommen Community All-Star
    Tenth Anniversary Kudos 5 March 2026 Challenge: Answered Questions January 2026 Monthly Challenge

    @Melissa Duffy Try adding a ( before AND Fund and ) after equals 21.

    Helpful tip I learned is when using a combo of AND and OR you generally want to use ( ). Everything outside of the ( ) applies to all desired results.

  • @Alex Wong Thank you! I couldn'tfigure out how to add the (), so I used the one of and it worked perfectly! Appreciate the help!

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Kudos 5 Facilitator 4 bbcon 2025 Attendee Badge

    @Melissa Duffy
    it will be useful in the future, read how to here:

Categories