Skip to content
Advertisement

retrieve rows based on parent relationship

This is the query:

I am trying to get all the checklist items that have the same item_stock_id from the checklists that have the same ambulance_id.

However, the query from above is not working, showing me this error:

Below is the ChecklistItem model:

And this is the Checklist model:

Advertisement

Answer

To constrain the eager load you need to specify the constraint within the subquery of with. You could try the below

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