Need Help Writing SQL query
        Posted  
        
            by user204588
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user204588
        
        
        
        Published on 2010-04-07T14:36:41Z
        Indexed on 
            2010/04/07
            14:43 UTC
        
        
        Read the original article
        Hit count: 221
        
I have two product tables Product1 and Product2. There is a one 2 one mapping on the field ProductId.
What I want is to get all the product ids where the Product2.Exported field is false AND Where the product ids that are in Product1 but not in Product2 table.
Right now I have two queries that I'm trying to mash into one.
SELECT ProductId FROM Product1 WHERE ProductId NOT IN(Select ProductId From Product2)
SELECT ProductId FROM Product2 WHERE Exported = 0
© Stack Overflow or respective owner