Listing items under categories

I have a table of products which holds a list of categoryID's that each product belongs to.

DB schema - https://app.quickdatabasediagrams.com/#/d/cQgIjj

I'd like to list the products for each category. If a product belongs  more than one category, then I wish for the product o be listed under each category it belongs to.

Is this possible? Currently, it is being listed as below.

StephenSaid_0-1698576978530.png

 

Solved Solved
0 2 133
1 ACCEPTED SOLUTION


@StephenSaid wrote:

Is this possible? Currently, it is being listed as below.


Yes, but you need a dedicated row for each Product/Category combination. This requires an additional table to house these combinations - a Product Category join table. 

So, instead of using the Products table in your grouped view, you would use the Product Category join table as the source.  This table should be simple like this:

Product Category ID Product Category
aaaa y1 z1
bbbb y1 z2

...where the Product and Category columns are Ref's each data table.  You can then add Virtual Columns to pull in any additional details you need to see on the join row from either table.

I hope this helps!

View solution in original post

2 REPLIES 2


@StephenSaid wrote:

Is this possible? Currently, it is being listed as below.


Yes, but you need a dedicated row for each Product/Category combination. This requires an additional table to house these combinations - a Product Category join table. 

So, instead of using the Products table in your grouped view, you would use the Product Category join table as the source.  This table should be simple like this:

Product Category ID Product Category
aaaa y1 z1
bbbb y1 z2

...where the Product and Category columns are Ref's each data table.  You can then add Virtual Columns to pull in any additional details you need to see on the join row from either table.

I hope this helps!

@WillowMobileSys 

Thanks for your help. I'm still in development and i'll implement this idea if this view is required.

Top Labels in this Space