Hi there 🙂
Would anybody here please be able to advise me what would be the best way to deal with my following dilema? :
I have 2 tables: products and users
products has the following columns: productid, title
users has the following columns: id name produce
What i'm trying to achieve is a way to associate any of the products from the products table to to each user in the users table. The way i see it is that i could have some form of int like a bitfield that would link to the products table. The problem with bitwise is i can't have more than 32 items? There surely must be a simpler way of doing this, but i'm clueless i'm afraid.
Here's an example of how i would like the data to end up:
table data first:
products
productid title
1 Tomatos
2 Pears
3 Carrots
4 Potatoes
5 Strawberries
6 Cherries
users
id name produce
1 Fred 345
2 John 26
3 Mark 1234
The above joined
id name produce
1 Fred Carrots, Potatoes, Strawberries
2 John Pears, Cherries
3 Mark Tomatoes, Pears, Carrots, Potatoes
Many thanks,
Nick