Skip to content
Advertisement

How to display Max Date amount in another column?

I want to derive column MSP_ADULT and MSP_CHILD based on the LATEST date record ADULT_AMT to be in MSP_ADULT and CHILD_AMT to be in MSP_CHILD column.

I want to my out like below.

Here is the code I am running, but it is not working.

Advertisement

Answer

So you want the last values of those conditional MAX’s.

Try FIRST_VALUE with a descending order.

Note that there’s also the LAST_VALUE window function, but that one can sometimes be misleading.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement