我有 3 个表,其中包含有关用户、产品和类别的相关信息
Users
--------------
id (PK) | user
--------------
1 Jessy
2 Emily
3 John
Products
--------------------------------------
id | user_id (FK) | product
--------------------------------------
1 1 iPhone
2 1 Galaxy S
3 1 xbox
4 2 PS5
5 2 MPhone
6 1 XPhone
7 3 PS3
Cateogories
---------------------------------------
id | product_id(FK)| cateogy
---------------------------------------
1 1 Phone
2 7 Gaming Console
3 4 Gaming Console
4 5 Phone
5 2 Phone
6 3 Gaming Console
7 6 Phone
伙计们,我如何使用sql获取属于该用户的类别的产品,如下所示?
Product List of Jessy
------
Phone
------
iPhone
Galaxy S
X Phone
------------
Gaming Console
------------
xbox