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 |
ShooterJ07
Starting Member
17 Posts |
Posted - 2007-07-31 : 17:03:13
|
This is a little weird.. and I'm not sure where the appropriate place to post this is.I have an application that has a table of Users. Basically, it is similar to a "friends list". It has two columns. Person 1 & Person 2. If Person1=John and Person2=Betty, then Betty appears on John's Friends List. If Person1=Betty and Person2=John, then John also appears on Betty's Friends List.I need to make sure everyone is on everyone's friends list (yeah... ugly.. I know). So, if I have 3 users - Bill, Joe, Dan.. then the table should look like this:Person1,Person2Bill,JoeBill,DanJoe,BillJoe,DanDan,BillDan,Joe------Now, when I add a 4th user, what is going to be the best way to add that 4th users to all 3 of the pre-existing users, as well as add all of the pre-existing users to the 4th user?Should I be attempting this programatically in my vb/c# code? Or is there a feature (trigger or something) in SQL Server that would allow me to accomplish this whenever a new user is added?Pardon my ignorance... this application was a purchased product and this is the only way I can make it function... :( |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-07-31 : 17:16:35
|
Sounds like you need to use a CROSS JOIN in SQL Server. And yes it can be done with a trigger.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|
|
|