October 8, 2010 at 5:31 am
Anyone can gv me a hand ? I really run out of ideas
Example I hv below 2 tables, what i needs is to generate a new output which will link the code together.
Tbl A
Code StartDate EndDate UF Sym
----------- ----------- ----------- -----------------------------------------------
3966 19990401 20091117 .TRXF US&T
3966 20091204 20100207 .TRXF US&T
3966 20100208 20100225 .TRXF US&T
9332 20100226 20100723 .TRXA US&P
9332 20100727 NULL .TRXA US&P
Tbl B
UF Sym NewUF NewSym
---------------------------------------------------------
.TRXF US&T .TRXA US&P
Expected output
UF OldCode Sym NewUF NewCode NewSym
---------------------------------------------------------
.TRXF 3966 US&T .TRXA 9332 US&P
anyone can help ?
October 8, 2010 at 5:50 am
select distinct
a1.UF, a1.Code OldCode, a1.Sym,
a2.UF NewUF, a2.Code NewCode, a2.Sym NewSym
from tblA a1
join tblB on tblB.UF = a1.UF
join tblA a2 on a2.UF = tblB.NewUF
Might work?
/T
October 8, 2010 at 6:31 am
it works !! thanks vry much dude 😀
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply