Skip to content
Advertisement

Selecting first element in Group by object Postgres

I have the following table and I want to get the specidic Amount per loan_ID that corresponds to the earliest observation with greater than or equal to 10 dpd per month.

The expected output:

Advertisement

Answer

Returns:

Loan_ID month Amount
1 2017-01-01 50000
2 2017-01-01 8784

You can find test case in db<>fiddle

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