sql select query in table one, NOT in table 2

Posted on 2005-05-09
Last Modified: 2013-12-12
what would be the best way to do the following SQL code?

i have two tables, i want to select everything from table 1 which has status > 3 and is NOT in table two. they are tied together by value called phoneName

{ Moved to PHP & Databases - Diablo84/PHP Page Editor }
Question by:qwertq
    LVL 32

    Accepted Solution

    by using a left join


    select table1.* from table1 left join table2 on table1.phoneName = table2.phoneName where table2.phoneName IS NULL and table1.status>3

    It selects everything in table 1 where status>3 and where there's no match in table2


    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    794 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

    15 Experts available now in Live!

    Get 1:1 Help Now