In Access, how to create a query to exclude some data from a table

Posted on 2011-05-05
Last Modified: 2012-05-11
I need create a query to exclude the data from a table based on ID, year and month.

Table 1:  ID, year, month, data1, data2....
Table 2:  ID, year, month

A query will get all data in Table 1 except those in Table 2

Question by:jjxia2001
    1 Comment
    LVL 26

    Accepted Solution

    SELECT T1.ID, T1.year, T1.month, T1.data1, T1.data2....
    FROM table1 T1
          LEFT OUTER JOIN table2 T2 ON T1.ID = T2.ID AND T1.year = T2.year AND T1.month = T2.month

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    restore daily backup 5 52
    How to show the last employee that updated a record 5 35
    SQL HELP 2 65
    Get the last inserted ID 11 55
    'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now