Here is my Table `EMP_EARN_DETAILS`. 

`Emp_Ern_No` is the primary key.

I need to get the amount for each `emp_no` for each `earn_no` where the `emp_earn_no` is the *maximum*.

[![enter image description here](https://i.stack.imgur.com/JlMcr.jpg)](https://i.stack.imgur.com/JlMcr.jpg)

The output should be as follows.

```
0004321    ERN001           2345          11
0004321    ERN002            345          10
0004321    ERN003            345           9
000507     ER-01             563           4 
000732     ERN001            2345          12
000732     ERN002               9          13
000732     ERN003             678           8

```

Please help me with the query