Imagine I have the following database structure, with the relevant foreign keys defined.
Manufacturer (1 to many)
-- Product (1 to many)
ie. a manufacturer can have many products, and a product can have many models
In MySQL to select all manufacturers, their products and their models in a single, indexed query I would do:
select * from Manufacturer LEFT JOIN Product ON (Product.manufacturer_id = Manufacturer_id) LEFT JOIN Model ON (Model.Product_id = Product.Product_id)
What query would I need to perform to extract every Manufacturer->Product->Model in a single object, that only uses a single database query ? (In Laravel/Eloquent this is known as eager loading)
Forgive what may appear to be a common question, but the answers I find in the forums seem to date back to 2016, so I don't know if they're still relevant (and they indicate it can't be done)