This is kinda hard to explain, therefore I'm gonna do this step by step
I have created a table called list_names, there I store the list of names such as (George, Tina, Bobby, etc...)
I have also created another table which called names_items, this table is basically where I store how many items this person has, it looks something like this:
id | name | Item
1 | Tina | Bag
2 | Tina | Pencil
3 | Bob | TV
4 | Bob | Computer
My goal is, to display all the names from list_names then count the sum of the items of each person has from names_items and join them together. if the person haven't bought anything yet, return 0. I also want to sort the result by the sum of the items of this person bought. Is there anyway to accomplish this using mysql only?