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  | 
                             
                            
                                    | 
                                         AskSQLTeam 
                                        Ask SQLTeam Question 
                                         
                                        
                                        0 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2003-09-15 : 07:21:21
                                            
  | 
                                             
                                            
                                            | kamran writes "I have 2 tables, a and b. a has 1000 records and b has 1500 records.i want the first record of a's quantity field to be multiplied with the first record of b's quantity... and so on till the 1000 records of a have been multiplied with b's first 1000 records quantity field... and i want to do this in a view.i am using MSDE." | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     mohdowais 
                                    Sheikh of Yak Knowledge 
                                     
                                    
                                    1456 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2003-09-15 : 07:42:32
                                          
  | 
                                         
                                        
                                          Kamran, in relational DMBS's there is no concept of first (or second or last). You will need some kind of link between the two tables to identify which row in TableA connects to which row in TableB. You probably have these as primary keys and foriegn keys. You need to JOIN the two tables by specifying the columns in each of the tables that identify the link. The query would be something like:SELECT A.ProductID, (A.Quantity * B.Quantity) AS ProductFROM TableA A INNER JOIN TableB BON A.PrimaryKeyColumn = B.ForiegnKeyColumnOwais Make it idiot proof and someone will make a better idiot  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |