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 |
|
EsQueueEll
Starting Member
2 Posts |
Posted - 2010-09-30 : 16:16:58
|
I'm not sure if this is possible with pure SQL but here's what I need to do.Find all applicable users that need to be updated.For each user, go to another table that holds information for them. If a column has one of the applicable values, start building a string. Set the string to another column value of another table through a foreign key. For each row that has an applicable value, add on to that string. So an example would be:UsersPK Name1 Bob2 JohnUser InformationPK VALUE Users FK1 NULL 12 NULL 2Information ValuesPK VALUE INFO FK USER PK1 55 lbs 1 12 French 2 1Information CategoriesPK NAME1 Bench Press2 Spoken Language So.. I would need the string "Bench Press, Spoken Language" for the first user, and so on for each other user, if it exists in the information values database, then put it in the user information database.I've been able to select the appropriate rows for each user, it's where I need to build the string I get completely lost. In setting my string after select, it only sets it to the last value of the select statement. So I definitely don't understand SQL at all in this capacity, nested loops don't even seem to work for me.Thanks for any help pointing me in the right direction! |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
|
|
|