Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | sqlslickYak Posting Veteran
 
 
                                        83 Posts | 
                                            
                                            |  Posted - 2009-10-29 : 16:12:41 
 |  
                                            | Hello,I am trying to run a query with 3 subqueries in the WHERE clause similar to this:WHERE ITEM_NO NOT IN (SELECT ITEM_NO FROM...)AND ITEM_NO NOT IN (SELECT ITEM_NO FROM...)AND ITEM_NO NOT IN (SELECT ITEM_NO FROM...)When I click on Run Query I can see the Running query progress bar fill up at the bottom but query doesn't seem to finish.  The syntax is OK and infinite loop is out of the question.  Anybody has any suggestions why this is happening?Thanks!J |  |  
                                    | madhivananPremature Yak Congratulator
 
 
                                    22864 Posts | 
                                        
                                          |  Posted - 2009-11-23 : 09:32:40 
 |  
                                          | Have you tried this?select ..from table tWHERE not exists(SELECT ITEM_NO FROM...where col=t.col)andnot exists(SELECT ITEM_NO FROM...where col=t.col)andnot exists(SELECT ITEM_NO FROM...where col=t.col)MadhivananFailing to plan is Planning to fail |  
                                          |  |  |  
                                |  |  |  |