Count the number of times a category is chosen by customers!

Asked

Viewed 38 times

0

I have a table with categories, and each client who registers can choose up to 10 corresponding categories that corresponds to his work!

These categories in the client table are saved the ID’s , I need each category to show in front of them the amount of times it has been marked

Example:

Food (15) Beverages (5) Bed (5) Kitchen (20)

The table categories and so

inserir a descrição da imagem aqui

And the clients table is recorded this way

inserir a descrição da imagem aqui

  • 1

    You save the customer categories separated by commas in the bank?

  • If the answer to the above question is "yes", I recommend reading of that question

  • Difficult to know the doubt or difficulty. It would be good to edit and put some examples of the data as they are in the table, and what tried and failed.

  • @Wallacemaxters - I read the context that you gave me, but I am creating a functionality in the system that is already created some two years ago. I can’t recreate what’s already there, just trying to deploy this category counting feature. On your second answer, I’m trying to create from scratch with the examples of the tables, I did a status and it worked correctly with the mysql COUNT() function, because it was just a query in the column, and what is breaking my head of how to do!

  • @Marcospaulo as Bacco said, I think the question lacks more examples.

  • @Wallacemaxters, I understand, I liked much more the explanation of the reading that Oce gave me, since I will need to give more maintenance in this system, and probably this will affect the performance, I will talk to the customer to give a bigger slap in the system to avoid future problems. I will talk to him even if it takes a little longer but better optimize than continue the way this

  • So I’m going to close this question that I’ve undertaken and see if I can work it out with my client, if it doesn’t, I’ll reopen it and explain it further

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.