Mysql query. Populate drop down menu with results which are not in a table

Posted on 2009-12-19
Last Modified: 2012-05-08
Hi Experts,
I am trying to write a query that populates a dropdown menu.
I need to filter out records that exist in one table and only show the rest of the records that dont exist. I cant seem to get this working.

When I switch the where clause I identify all the records I want to exclude
properties.Prodtypeid = cases.Prodtypeid

How does one write the query propely





Left Outer Join cases ON cases.Prodtypeid = properties.Prodtypeid


properties.Prodtypeid <>  cases.Prodtypeid

Open in new window

Question by:matthewdacruz
    LVL 4

    Accepted Solution

    Here, try this code. I assumed you wanted table cases excluded, but maybe it was the other way around. Also not sure if you still wanted the join, even excluding with this method. Anyway, this should be what you're looking for.
    select Prodtypeid, ProductName from properties where not exists (select * from cases where properties.Prodtypeid = cases.Prodtypeid)

    Open in new window


    Author Closing Comment

    Thanks me655321

    That did the trick

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article describes some very basic things about SQL Server filegroups.
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    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

    21 Experts available now in Live!

    Get 1:1 Help Now