I am currently building a projects asp application and designing the database for this. At the moment I am having problems.
I have 2 tables t_proj (projects info) and t_users (user info). Projects contains projects info and users contains all the users of the app, information on the user (email etc) and their different access levels.
ie certain users should be able to add projects etc but some should not.
My problem is that every project has a manager and a sponsor associated.
The t_proj table has the following fields
f_proj_id (pk)
f_name
f_manager_id (related to t_users.f_user_id)
f_sponsor_id (related to t_users.f_user_id)
etc.....
The manager and sponsor id relate to the t_users table which has the following fields.
f_user_id(pk)
f_forename
f_surname
etc.....
I want to select the info in t_proj but return f_manager_id and f_sponsor_id as the forname and surname of the appropriate user.
If I try a usual Select I get
SELECT t_proj.f_proj_id, t_proj.f_name, t_users.f_forename, t_users.f_surname FROM t_proj INNER JOIN t_users ON t_proj.f_manager_id = t_users.f_user_id
But then can not do another join to get the sponsor without doing another select.
I have tried creating a table for managers t_mgr and a table for sponsors t_sponsor both with
f_user_id and f_proj_id but still get the same problem.
I know I can return all the ids from the t_proj table then maybe do another select based on what is returned, but this seems quite cumbersome.
Is there a table I am missing, am I just being dumb?
I am fairly new to this.
I have 2 tables t_proj (projects info) and t_users (user info). Projects contains projects info and users contains all the users of the app, information on the user (email etc) and their different access levels.
ie certain users should be able to add projects etc but some should not.
My problem is that every project has a manager and a sponsor associated.
The t_proj table has the following fields
f_proj_id (pk)
f_name
f_manager_id (related to t_users.f_user_id)
f_sponsor_id (related to t_users.f_user_id)
etc.....
The manager and sponsor id relate to the t_users table which has the following fields.
f_user_id(pk)
f_forename
f_surname
etc.....
I want to select the info in t_proj but return f_manager_id and f_sponsor_id as the forname and surname of the appropriate user.
If I try a usual Select I get
SELECT t_proj.f_proj_id, t_proj.f_name, t_users.f_forename, t_users.f_surname FROM t_proj INNER JOIN t_users ON t_proj.f_manager_id = t_users.f_user_id
But then can not do another join to get the sponsor without doing another select.
I have tried creating a table for managers t_mgr and a table for sponsors t_sponsor both with
f_user_id and f_proj_id but still get the same problem.
I know I can return all the ids from the t_proj table then maybe do another select based on what is returned, but this seems quite cumbersome.
Is there a table I am missing, am I just being dumb?
I am fairly new to this.