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  | 
                             
                            
                                    | 
                                         robertnzana 
                                        Starting Member 
                                         
                                        
                                        42 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-05-20 : 11:57:15
                                            
  | 
                                             
                                            
                                            I have table (Table1) with a bunch of records.  The pk is "Id".I have table2 with 1 column, listing Id's I have to delete (from Table1).What is the syntax to delete the records from Table1 (if the Id shows up in Table 2?)This doesn't seem to work...DELETE FROM Table1 INNER JOIN Table2 ON Table1.Id=Table2.Id; Thanks. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     harsh_athalye 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    5581 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 12:09:42
                                          
  | 
                                         
                                        
                                          | [code]Delete t1FROM Table1 t1 INNER JOIN Table2 t2 ON t1.Id=t2.Id[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     robertnzana 
                                    Starting Member 
                                     
                                    
                                    42 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 12:12:19
                                          
  | 
                                         
                                        
                                          | That syntax doesn't seem to work in Access. Are you sure?  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     harsh_athalye 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    5581 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 12:22:27
                                          
  | 
                                         
                                        
                                          | [code]Delete Table1.*FROM Table1 INNER JOIN Table2 ON (Table1.Id=Table2.Id)[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     robertnzana 
                                    Starting Member 
                                     
                                    
                                    42 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 12:35:27
                                          
  | 
                                         
                                        
                                          Thanks Harsh for the input.I tried it and that syntax doesn't work either. Are you sure this is supposed to work with Access?Thanks again!    | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     harsh_athalye 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    5581 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 12:37:04
                                          
  | 
                                         
                                        
                                          | The 2nd one works for me.Which version of MS Access you got?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     robertnzana 
                                    Starting Member 
                                     
                                    
                                    42 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-20 : 13:12:42
                                          
  | 
                                         
                                        
                                          | The latest. That's wierd. Lemme double check...  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |