Reputation: 119
Consider a table
StudentId | Subject | Marks |
---|---|---|
1 | Maths | 34 |
1 | Science | 54 |
2 | Maths | 64 |
2 | French | 85 |
2 | Science | 74 |
I'm looking for an output where it will give (note that I'm trying to find MAX marks for each student, irrespective of the subject)
StudentId | Subject | Marks |
---|---|---|
1 | Science | 54 |
2 | French | 85 |
Upvotes: 1
Views: 255
Reputation: 363
In addition to above query from @Avnera, if you also care about the corresponding subject in which the student received the maximum marks (it seems like that based on your desired output table), you can use the arg_max
function:
T
| summarize arg_max(Marks, Subject) by StudentId
arg_max(): https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/arg-max-aggfunction
Upvotes: 2