ablbaset ablbaset - 13 days ago 5
MySQL Question

Create several group based on their Interest-based

Create several group based on their Interest-based. I am using php and mysql.

my user table


  1. name_one

  2. name_two

  3. name_three

  4. name_four

  5. etc..
    6.
    7.
    8.



I would to select some names and create a group

Ex:

256 users interest in football = Foot Ball group

549 users interest in cricket = Cricket Group

Note: Football users can be in cricket as well.

My question is how can I create many users group from user table rows. Should it create extra table? Please help me.

Answer

I suggest you to create a table interest(id_interest, name), then a 3rd table interest_user(id_user, id_interest)

I suggest using interest as table name instead of group because it has a special meaning in mysql.

Comments