Author |
Topic |
DonDen
Starting Member
4 Posts |
Posted - 2011-09-30 : 14:44:38
|
Some what new to SQL and I am trying to update a table based on the userid and areaid from two other tables, User table and Area table. The table I am updating is userarea and gives permisison to each are by user role. Here is what I have at this time along with the error I am getting.INSERT INTO userarea ( userid, areaID )VALUES((select userID from [user]where RoleID = 4294967304),(SELECT AreaID FROM area WHERE AreaID = 10488310136835))Msg 512, Level 16, State 1, Line 1Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.The statement has been terminated.Also wantedd to mention that if there is just one user in the role than the obove statement works.Here are the reults of the individual slect statements. userID12884902519128849025214582730104834834941642342783494164234298349416423432834941642343483494164234368349416423438834941642344083494164234428349416423444834941642344683494164234488349416423452834941642345710475425234947AreaID10488310136835This is the end result of the userarea table I am looking for.userID areaID12884902519 1048831013683512884902521 104883101368354582730104834 104883101368358349416423427 104883101368358349416423429 104883101368358349416423432 104883101368358349416423434 104883101368358349416423436 104883101368358349416423438 104883101368358349416423440 104883101368358349416423442 104883101368358349416423444 104883101368358349416423446 104883101368358349416423448 104883101368358349416423452 104883101368358349416423457 1048831013683510475425234947 10488310136835 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
DonDen
Starting Member
4 Posts |
Posted - 2011-09-30 : 16:41:33
|
Thanks Tara, that did the trick. To expand slightly would there be away to do this for 65 areaids at once? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
DonDen
Starting Member
4 Posts |
Posted - 2011-09-30 : 17:14:23
|
Each userid would need to match up with each areaid for instance:userid1 areaid1userid1 areaid2userid1 areaid3DonDen |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
DonDen
Starting Member
4 Posts |
Posted - 2011-09-30 : 17:56:25
|
tara, thanks for your help. This will get me what I need. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|