Mysql table structure

MySQLtable

I will have a "clients" table and a "users" table what i wanna do is restrict access to some clients for some users

My question is how should i do the table structure for this? One solution comes to my mind is defining a field in clients table and putting the user ids in that field who wont have access to that client (so i can use that ids to check/exclude from result) but i dont know if it is efficent way? I mean if i do such field i am thinking to define it as "blob" field as i wont know how long that field should be, but i have concerns using a blob field/putting ids in one field? Will query be slow?

Is there a better/common way? Or my way is completely wrong?

Best Answer

A suitable solution is to create third table to link users with clients and so give access:

users             lnk_user_client_access                
-----             ----------------------                clients   
id_user --------- id_user                              --------
...               id_client   ------------------------ id_client
                                                       ...