SQL Outer Join Query Issue

Posted on 2007-08-09
Last Modified: 2013-11-05
I am trying to find all of the records in table 2 that do not exsist in Table 1 with some criteria like are open for business. I am using SQL 2000.
Question by:mwhodges
    LVL 19

    Accepted Solution

    select * from table1 left outter join table2 on table1.somefield = table2.somefield where table2.somefield is null

    change somefield to a unique field in the tables
    LVL 61

    Expert Comment

    Assuming you have a common ID field:

    SELECT Table2.*
    FROM table2 LEFT JOIN Table1 on Table2.ID = Table1.ID
    WHERE Table2.OpenForBusiness = true and Tabale1.ID IS Null

    Author Comment

    Thanks for your quick responses. That fixed it.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
    Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 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

    14 Experts available now in Live!

    Get 1:1 Help Now