can anyone help with the the query please? i am having hard time with it...
create table #Table1
(PK int
,SomeNumber int
,MatchOnNumber int
)
INSERT INTO #Table1 VALUES(100,111,99999 )
INSERT INTO #Table1 VALUES(100,111,88888)
INSERT INTO #Table1 VALUES(100,111,77777)
INSERT INTO #Table1 VALUES(100,111,66666 )
INSERT INTO #Table1 VALUES(200,222,44444 )
INSERT INTO #Table1 VALUES(200,222,33333)
INSERT INTO #Table1 VALUES(200,222,22222)
Create Table #Table2
(MatchNumber1 int
,matchNumber2 int
,MatchNumber3 int
)
INSERT INTO #Table2 VALUES (66666,77777,88888)
INSERT INTO #Table2 VALUES (44444,33333,22222)
--- desired output:
Create Table #DesiredOutput
(
PK int
,SomeNumber int
,MatchOnNumber int
,RowNumber INT
)
INSERT INTO #DesiredOutput VALUES(100,111,99999,1)
INSERT INTO #DesiredOutput VALUES(100,111,88888,1)
INSERT INTO #DesiredOutput VALUES(100,111,77777,1)
INSERT INTO #DesiredOutput VALUES(200,222,44444,2)
INSERT INTO #DesiredOutput VALUES(200,222,33333,2)
INSERT INTO #DesiredOutput VALUES(200,222,22222,2)
SELECT * FROM #DesiredOutput