Group Group Group Group Group Group Group Group Group

[Fluent4] - "JOIN" with filter

Hi everyone, I am currently migrating from Vapor 3 to Vapor 4 and run into a problem in Fluent.

How could I migrate that “JOIN” to Fluent4? I have tried several ways but I have not been able to find the solution.

let requestTotal: EventLoopFuture = OMOrderModel.query(on: parameters.connection)
.join(\OMCustomerModel.id, to: \OMOrderModel.customerID)
.filter(\OMCustomerModel.name, .like, name.prefixQuery)
.count()

Basically I apply a filter by name to the “JOIN”. But the name field corresponds to my parent table.

I hope someone I can help me. Thank you very much.

Hahaha, browsing the web i have a solution. Then everything is alright :sweat_smile: :rofl:

Link: The difference in sql queries for join vs parent relation in Vapor