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  | 
                             
                            
                                    | 
                                         programer 
                                        Posting Yak  Master 
                                         
                                        
                                        221 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2013-09-26 : 15:01:25
                                            
  | 
                                             
                                            
                                            | tbl_Events:Id, DetailId,Date,Event1838 	598 	NULL 	28.9.2013 11:45:00 	Tottenham - Chelsea 	3Way - result 	Tottenham 	NULL 	2,65 	01839 	598 	NULL 	28.9.2013 14:00:00 	Aston Villa - Manchester City 	3Way - result 	Aston Villa 	NULL 	7,00 	01840 	598 	NULL 	28.9.2013 14:00:00 	Fulham - Cardiff City 	3Way - result 	Fulham 	NULL 	2,10 	0tbl_SystemId, BetSlipDetailId, BetSlipEventId,SystemId2990 	598 	1838 	1838,1839|1838,1840My code:--AB	Insert into tbl_BetSlipSystem(BetSlipDetailId,BetSlipEventId,SystemBet)	Select BetSlipDetailId,Id,'AB' from	(Select row_number() over(order by id) as Number, Id,BetSlipDetailId from inserted) as a	Where a.Number IN (1,2|1,3)So, If I first select row_number 1,2 and then 1,3.In the table tbl_System I need to insert Id from first table:1838,1839|1838,1840 | 
                                             
                                         
                                     | 
                             
       
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |