Skip to content
Advertisement

get records that last record binded with it have a specific value

I have this caseenter image description here

where there is 2 tables:

book for example

and loan for example:

I need to get all books id , where the last loan duration equals , so in this example it will be : [1,2]

Advertisement

Answer

One method uses aggregation:

This checks that the last id for a given book matches the last id for a given book with the duration you want.

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