with Demo as( select max(Col3)as total,Col2 from [tbl_Demo] group by Col2) select total,Col2,(select Col1 from [tbl_Demo] where Col3=total )as ID from Demo
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)