1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SQL query for removing current and future dates?

Discussion in 'Programming/Internet' started by Steven B, Sep 12, 2018.

Tags: Add Tags
  1. Steven B

    Steven B Guest

    I would like to filter out all records that have a date in the future AS WELL AS any records in the current month. I attempted to use this query:

    WHERE (Month(DueDate) < Month(getdate()) AND (Year(DueDate) <= Year(getdate())))

    The issue is that it doesn't return any results that were previous year but a month that is greater than the current. ie: Today's date is 9/12/18, it would not return any records that had a month of 10, 11 or 12 regardless of the year.

    Login To add answer/comment

Share This Page