I have tree tables:
Persons:
- id
- name
Books
- id
- title
Quantity:
- People_id
- Product_id
- quantity
I need a result with : in the columns the Book title, in the rows the Persons name, in the cells the quantity take from the cross of peoples and books
I have tree tables:
Persons:
Books
Quantity:
I need a result with : in the columns the Book title, in the rows the Persons name, in the cells the quantity take from the cross of peoples and books
select *
from persons p join quantity q on p.id = q.people_id
join books b on q.product_id = b.id
JOIN should help (if you need columns from all table then add alias.* for other tables in SELECT).
SELECT p.*
FROM persons p
JOIN quantity q ON p.id = q.people_id
JOIN books b ON q.product_id = b.id