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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 getting a max value from table

Author  Topic 

kkiranvr
Yak Posting Veteran

54 Posts

Posted - 2010-05-13 : 18:00:40
Here is the scenario,

id value
1 300
1 400 (max value for id -=1)
2 500 (max value for id = 2)
2 299
2 300

I want o/p as
id value
1 400
2 500

Explanation: I want to get the max(calue) from the table who is having the same id.

Thanks
Chinna.




-Thanks N Regards,
Chinna.

singularity
Posting Yak Master

153 Posts

Posted - 2010-05-13 : 18:22:29
[code]
select id, max(value) as value
from yourtable
group by id
[/code]
Go to Top of Page
   

- Advertisement -