SELECT then INSERT data in a matrix way
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I have a question regarding SQL queries. In my select statement in my stored procedure I will receive a table of information like this: UserId ------ 2 4 5 After this select statement I'd like to add a insert statement to add records For each of these UserIds (as UserIdFrom) with the other ones (as UserIdTo) I want to Insert into a table information like following: UserIdFrom UserIdTo ---------- -------- 2 4 2 5 4 2 4 5 5 2 5 4 I would be grateful if someone help me :) SELECT UserId FROM Users INSERT INTO myTable (UserIdFrom, UserIdTo) VALUES (@UserIdFrom, @UserIdTo)