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 |  
                                    | nadhymStarting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2012-04-10 : 04:35:04 
 |  
                                            | Hi.. I need a query to select data from two tables and set the value of a column based on the data on table 2.example: Table 1 contain student name and ID.Table 2 contain ID and grade.result should contain, the ID, name ( selected from table 1 based on the ID) and grade. |  |  
                                    | webfredMaster Smack Fu Yak Hacker
 
 
                                    8781 Posts | 
                                        
                                          |  Posted - 2012-04-10 : 11:03:28 
 |  
                                          | selectt1.ID,t1.name,t2.gradefrom table1 as t1left join table2 as t2 on t2.id = t1.id No, you're never too old to Yak'n'Roll if you're too young to die.
 |  
                                          |  |  |  
                                    | nadhymStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2012-04-11 : 01:35:09 
 |  
                                          | Thank You Webfred.. :)Example was just a SampleBut i want the name to be selected based on the ID.Which means if the ID is '70', the query should search it from Table 1.Thank you Again.. |  
                                          |  |  |  
                                    | webfredMaster Smack Fu Yak Hacker
 
 
                                    8781 Posts | 
                                        
                                          |  Posted - 2012-04-11 : 02:57:11 
 |  
                                          | Do you know the WHERE clause?Just addWHERE t1.ID = 70at the end of the query No, you're never too old to Yak'n'Roll if you're too young to die.
 |  
                                          |  |  |  
                                |  |  |  |