2
도움을 얻으려는 시도는 @ temp2의 intA 및 intB 열 모두에 해당하는 @ temp2의 ID 열을 얻는 것입니다. 최종 결과 결과가 뭔가 보일 것이라고 기대합니다. 같은 :MS-SQL 쿼리에 대한 도움이 필요합니다.
여기intA intB 'asset1' 'asset2' 'name1' 'name2'
1 1 108 108 Cash Cash
1 2 108 109 Cash Commodities
1 3 108 138 Cash Stock
.
.
.
2 5 109 111 Commodities Equity
내가 함께 일하고 일부 샘플 데이터입니다 :
declare @temp1 table
(
intA int,
intB int
)
insert @temp1
select 1,1 union all
select 1,2 union all
select 1,3 union all
select 1,4 union all
select 1,5 union all
select 2,1 union all
select 2,2 union all
select 2,3 union all
select 2,4 union all
select 2,5
select * from @temp1
declare @temp2 table
(
oneup int,
id int,
name varchar(30)
)
insert @temp2
select 1,108,'Cash' union all
select 2,109,'Commodities' union all
select 3,138,'Stock' union all
select 4,110,'Bonds' union all
select 5,111,'Equity'
select * from @temp2
select t1.*,t2.* from @temp1 t1
inner join @temp2 t2
on t1.intA = t2.oneup
내가 할 수없는 내가 기대처럼 나에게 출력을 제공하는 권리를 일을 가입 할 수 있습니다. SQL2008 사용
도움을 주셔서 감사합니다!
+1 샘플 데이터 포함. –