[eluser]pabloheim[/eluser]
Hi,
im developing a mini app where a boss assigns a task to some members of the staff. each member has an id and a name. The task has an id too.
In your opinion, what is the best way to store in a databse the link between a task and the part of the staff that have to solve it?
for example, my first idea was this:
the tasks table has a column called team that is a string like this: "1,4,8" .This means that members whose id are 1, 4 and 8 have to solve the task. This is easy to insert, but a little difficult to extract (lack of flexibility)
i have another idea : imagine we have a table called assignments. it has two columns : "task_id" and "member_id". If the boss asks members 1, 4,8 to solve the task "30", then this is stored like this:
Code:
---------------------
task_id | member_id |
---------------------
30 | 1
---------------------
30 | 4
---------------------
30 | 8
---------------------
This solution is easy for extract : select member_id where task_id="30"
but a little bit difficult to insert.
What do you think??
Thanks in advance and sorry for my english.