September 24, 2019 at 6:34 pm
hello
this is imple inner join query
declare @t table (id int not null identity(1,1),x int ,y int,z int,v int)
declare @f table (id int not null identity(1,1),name nchar(20))
insert @t values(1,0,0,0)
insert @f values('Black'),('James')
select * from @t t inner join @f f on t.id=f.id
give me this result
id x y z v id name
----------- ----------- ----------- ----------- ----------- ----------- --------------------
1 1 0 0 0 1 Black
(1 row(s) affected)
but how can i give this result ?
name values
-------------------- ------
Black x y z v
1 0 0 0
this is sub column
have any method giving this result?
September 24, 2019 at 9:19 pm
i hope i am not reading this wrong, but it looks like what you want to do is instead of using SELECT *, to select explicit column names.
good job on aliasing all your tables!
the second query I appended returns the desired result; side by side, i hope you see the difference.
declare @t table (id int not null identity(1,1),x int ,y int,z int,v int)
declare @f table (id int not null identity(1,1),name nchar(20))
insert @t values(1,0,0,0)
insert @f values('Black'),('James')
select * from @t t inner join @f f on t.id=f.id
select
f.name,
t.x,
t.y,
t.z,
t.v
FROM @t t inner join @f f on t.id=f.id
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply