Hi, I want to insert different values from different rows which I get from a select statement into a table. The Problem is that all rows have the same data type. But I want to get the values of one row to another. Sounds complicated but if you see my example you probably know what I mean.
Initiating Table should look like this
bigint bigint bigint bigint
ROW A B C D
1 2 3 4
=> This entry should be added from the 1st line
4 1 2 3
next one would be like this:
3 4 1 2
Every line should be generated from a select statement of line before.
Who knows how to do this and why is a statement like this not possible?
insert into test (A,B,C,D) Values (select top 1 B from test where A=1,
select top 1 C from test where A=1
select top 1 D from test where A=1
select top 1 A from test where A=1
);
Initiating Table should look like this
bigint bigint bigint bigint
ROW A B C D
1 2 3 4
=> This entry should be added from the 1st line
4 1 2 3
next one would be like this:
3 4 1 2
Every line should be generated from a select statement of line before.
Who knows how to do this and why is a statement like this not possible?
insert into test (A,B,C,D) Values (select top 1 B from test where A=1,
select top 1 C from test where A=1
select top 1 D from test where A=1
select top 1 A from test where A=1
);