Need urgent help with calculation of quantities

I have two tables: Company and Products. The Products table has a relation to the Company table. In the Products table, there’s a column that can store multiple product entries with their respective quantities, such as:

  • Glass: 2
  • Glass: 3
  • Rubber: 4
  • Rubber: 8
  • Tile: 1

What I want is to calculate the total quantity for each unique product. For example, the output for the above data should be:

  • Glass: 5
  • Rubber: 12
  • Tile: 1

How can I achieve this?

Create a relation linking the product to itself.
Then rollup the relation.

1 Like

All the data is part of a single row, roll up gives a single value and I want rollups for the unique items, there will be 3 rollups in the above case

Can you show how you are storing the data? Is it JSON?

1 Like

And whether if it’s a JSON or just like what you described above, can you tell how it was input into that column?

1 Like