Subject | some sql help |
---|---|
Author | Henrik Sitter |
Post date | 2004-03-01T12:23:27Z |
Hi, if I have the following table:
Id Value
1 100
1 200
2 300
If I want to retrieve the maximum value in each Id group, i.e. line 2
and 3, I was hoping that I could write:
Select max(Value), Id
From aTable
Group by Id
I'm not getting the results I was hoping for using this method, but it
might be that there is something else that is wrong since this is just
part of a stored procedure.
Henrik
[Non-text portions of this message have been removed]
Id Value
1 100
1 200
2 300
If I want to retrieve the maximum value in each Id group, i.e. line 2
and 3, I was hoping that I could write:
Select max(Value), Id
From aTable
Group by Id
I'm not getting the results I was hoping for using this method, but it
might be that there is something else that is wrong since this is just
part of a stored procedure.
Henrik
[Non-text portions of this message have been removed]