I have this sample table:
id    branch    branch_running_no
1      1         5
2      1         10
3      2         5
4      2         10
5      3         5
6      3         10
7      4         5
8      4         10
9      5         5
10     5         10
Using this query, I can get the max branch_running_no for each branch column but I also want to include the column id of the max branch_running_no.
SELECT branch, MAX(branch_running_no) from table1 GROUP BY branch order by branch;
I was able to achieve:
branch    max
1         10
2         10
3         10
4         10
5         10
but i need:
id    branch    max
2     1         10
4     2         10
6     3         10
8     4         10
10    5         10
 
     
    