Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Arun.G
Yak Posting Veteran
81 Posts |
Posted - 2010-05-25 : 10:18:26
|
| I have one master table which contains datfor example: Tablerolesroleid roles1 trainee2 leader3 supervisor etc, Now I have another table: Tableprofileex:prid name designation roles1 aaa uuu 1,2In role column i want to get the multiple roles for one person and also want to store that id of roles only, but in front end i have option to select only rolename from dropdown list, but in backend it should stored as id onlyhow to write query for this? |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-05-25 : 10:51:20
|
| Can you provide table structure with some sample data so that we can understand your requirement in detail. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-05-25 : 11:21:21
|
quote: Originally posted by Arun.G I have one master table which contains datfor example: Tablerolesroleid roles1 trainee2 leader3 supervisor etc, Now I have another table: Tableprofileex:prid name designation roles1 aaa uuu 1,2In role column i want to get the multiple roles for one person and also want to store that id of roles only, but in front end i have option to select only rolename from dropdown list, but in backend it should stored as id onlyhow to write query for this?
Why do you want to do this? This is not a good design to have all roles in a single row separated by commas. |
 |
|
|
Arun.G
Yak Posting Veteran
81 Posts |
Posted - 2010-05-26 : 01:34:55
|
| As per our requirement ,Manager who is also one of the employee of organization should contain multiple roles, thats why, we want to store multiple roles for some employees by comma seperated valuesfor example: TableprofileSlNO Name Address Position Roles1 aa tt Trainee 12 bb uu Employee 23 cc vv Manager 1,2,34 dd ww Trainee 1Master Table:RolesRoleid Roles1 Tra2 Emp3 AdminNow I want to display the result like below:SlNO Name Roles1 aa Tra 2 bb Emp 3 cc Tra,Emp,Admin4 dd Trai want query for this issue |
 |
|
|
|
|
|
|
|