How to aggregate data by field which field type is 'TYPE"

Hi there,

I am building simple order management app.
I want to show the chart of the sales result by grouping some fields.
The problem is I cannot group by the field which field type is ‘TYPE’
e.g. I want to display sales result of each product by grouping by User’s age.

Here is how I structure the database.
3 simple DB

DB1: user
name, age, sex, place

DB2: products
name, price

DB3: orders
user, products, quantity

The result I want to achieve:
Sold apple: 4pcs by age 10-20, 7pcs bu age 21-30

One idea to deal with that setting up age field on ‘order type’ but if we so, ‘order type’ will have many field which you can refer in ‘user type’.
I don’t think this is good idea in terms of smart data structure as we as workload unit efficiency.

Let me know if you have any idea.
Thank you.



This topic was automatically closed after 70 days. New replies are no longer allowed.