ablbaset ablbaset - 1 year ago 75
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..

I would to select some names and create a group


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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download