The table structure is shown below.
What I want to show you is to show the materials that belong to the product in the product list.
Product 1 | (Material 1, Material 2)
Product 2 | (Material 1, Material 3)
Product 3 | (Material 2, Material 3, Material 4)
Product 4 | (Material 1, Material 2, Material 3)
I have to join three tables, but I can't think of what to do.
Is it possible only with sql?
SELECT *
FROM products
JOIN bill_of_material ON products.unit_id = bill_of_material.unit_id
JOIN materials ON bill_of_material.material_id = materials.material_id
You can do it like this.
Please keep that in mind: https://www.w3schools.com/sql/sql_join_inner.asp
© 2024 OneMinuteCode. All rights reserved.