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 |  
                                    | asifbhuraPosting Yak  Master
 
 
                                        165 Posts | 
                                            
                                            |  Posted - 2013-09-06 : 16:30:39 
 |  
                                            | Hello...I have records as belowstd_name std_id  Grade ABC       456    7 - A ABC       456    8 - B XYZ       568    2 - C XYZ       568    5 - DI want to distinct with std_code and max with grade like belowstd_name std_id  Grade ABC       456    8 - B XYZ       568    5 - D |  |  
                                    | TGMaster Smack Fu Yak Hacker
 
 
                                    6065 Posts | 
                                        
                                          |  Posted - 2013-09-06 : 17:21:34 
 |  
                                          | select std_name, std_id, max(Grade) Grade from <yourTable> group by std_name, std_idBe One with the OptimizerTG |  
                                          |  |  |  
                                    | VeeranjaneyuluAnnapureddyPosting Yak  Master
 
 
                                    169 Posts | 
                                        
                                          |  Posted - 2013-09-10 : 05:06:50 
 |  
                                          | quote:veeranjaneyuluOriginally posted by TG
 select std_name, std_id, max(Grade) Grade from <yourTable> group by std_name, std_idBe One with the OptimizerTG
 
 |  
                                          |  |  |  
                                |  |  |  |