Is there a best practice join sql, I want to get the associated data through a join sql without looping through the database

When I follow the documentation of resolvers and want to use left join to query the data of both, I found that the status quo is to query the external data once and then will loop the data of the related table, which is not a good practice