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 |  
                                    | nrajeshkumarsStarting Member
 
 
                                        5 Posts | 
                                            
                                            |  Posted - 2014-03-05 : 23:58:19 
 |  
                                            | ItemID	ItemName	Price1	Item1	120.002	Item2	234.003	Item3	250.004	Item4	300.005	Item5	300.006	Item6	290.007	Item7	170.008	Item8	90.009	Item9	170.00the above is the existing table and i need a query to retrieve max price with out using max function and sub queryN.Rajesh kumar |  |  
                                    | khtanIn (Som, Ni, Yak)
 
 
                                    17689 Posts | 
                                        
                                          |  Posted - 2014-03-06 : 00:00:52 
 |  
                                          | homework ? KH[spoiler]Time is always against us[/spoiler]
 |  
                                          |  |  |  
                                    | nrajeshkumarsStarting Member
 
 
                                    5 Posts | 
                                        
                                          |  Posted - 2014-03-06 : 00:04:56 
 |  
                                          | YES.. quote:N.Rajesh kumarOriginally posted by khtan
 homework ?
 KH[spoiler]Time is always against us[/spoiler]
 
 |  
                                          |  |  |  
                                    | khtanIn (Som, Ni, Yak)
 
 
                                    17689 Posts | 
                                        
                                          |  Posted - 2014-03-06 : 00:05:56 
 |  
                                          | so can you use the TOP keyword ? KH[spoiler]Time is always against us[/spoiler]
 |  
                                          |  |  |  
                                    | nrajeshkumarsStarting Member
 
 
                                    5 Posts | 
                                        
                                          |  Posted - 2014-03-06 : 00:09:59 
 |  
                                          | we can use but what if we have multiple records with same price?we should not do hard code.N.Rajesh kumar |  
                                          |  |  |  
                                    | khtanIn (Som, Ni, Yak)
 
 
                                    17689 Posts | 
                                        
                                          |  Posted - 2014-03-06 : 01:23:13 
 |  
                                          | use get the top price in derived table and JOIN to your main table select *from   yourtable t       inner join       (           select top 1 price from yourtable order by price desc       ) p on t.price = p.price KH[spoiler]Time is always against us[/spoiler]
 |  
                                          |  |  |  
                                    | khtanIn (Som, Ni, Yak)
 
 
                                    17689 Posts |  |  
                                |  |  |  |