Grouping rows based on presence of single attribute

Hello,

I have 3 rows like this…

companyA: US
companyB: CA
companyC: US, CA

But I want to be able to group by territory so that I see…

CA
companyB
companyC

US
companyA
companyC

Is that possible? I.e. to have single rows such as “companyC” appear in multiple groupings because of the multiple attributes it contains? If not, the problem is that I’d have to create 2 rows for companyC which is annoying if you want to apply a company-level comment to the row.

Thanks for any thoughts,

Daniel

You would need to create a many-to-many relationship, and then do your grouping from the junction table. You can learn more about many-to-many relationships here:

Thanks but then I’d still end up with multiple rows in the junction itself right? E.g. I’d have to see 2 rows like companyC-US and companyC-CA. I don’t have an issue with modelling a many-to-many mapping - it’s just a grouping/visualisation problem. I need a way to group by single/distinct countries so that in my example I only see 1 group for US and 1 group for CA (instead of also a group for US,CA)

That is correct… in either your current table or a junction table, you will need more than one row per company.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.