Wednesday, March 21, 2012

find the greater element in list

I have a table with 2 field Id and amount.

I want to select the maximum amount for all the Ids.

e.g.

IdAmount

1

23

1

47

2

23

250

37

The result set should be

1

47

2

50

3

7

Can any one give any sql query to

fetch the appropriate result?

select ID, max(Amount)

from your table

Group by id

|||

Did it work?

If so, can you mark answer as correct. thanks

sql

No comments:

Post a Comment