At the moment there is a request:

SELECT * FROM shop.gropsandproducts s inner join shop.products on s.ProductId = shop.products.Id inner join shop.groups on s.GroupId = shop.groups.Id 

result:

enter image description here

As can be seen from the result, the groups table is connected to the category table by the CategoryId field.

I do not understand what needs to be added in order to still display the Category table (by linking it to the groups table).

  • one
    Just as you did with the other two tables, using JOIN - Vladimir Klykov

1 answer 1

From all this follows (if the fields are correct):

 SELECT * FROM shop.gropsandproducts s inner join shop.products on s.ProductId = shop.products.Id inner join shop.groups on s.GroupId = shop.groups.Id inner join shop.category on shop.category.Id = shop.groups.CategoryId