sql server - Get Exact Match Rows in same Sequence using SQL Query -
i have 2 table , data in following format. need match rows using sql server query table number 2 in same sequence appearing in table number 1.
tab 1:
sno codeseq lno docno
3845 255636363 1 anydoc
3846 255696969 1 anydoc
3847 255747474 1 anydoc
3865 255646464 2 anydoc
3866 255707070 2 anydoc
tab 2
sno codeseq lno docno
53951 255636363 21 demo1
53952 255696969 21 demo1
53953 255747474 21 demo1
53954 255747474 21 demo1
53955 255737373 21 demo1
54086 255646464 22 demo1
54087 255707070 22 demo1
54088 255747474 22 demo1
54089 255636363 115 demo2
54090 255696969 115 demo2
54091 255747474 115 demo2
54092 255747474 116 demo2
54093 255737373 116 demo2
54094 255747474 116 demo2
i need output result in format.
sno codeseq lno docno
53951 255636363 21 demo1
53952 255696969 21 demo1
53953 255747474 21 demo1
54086 255646464 22 demo1
54087 255707070 22 demo1
54089 255636363 115 demo2
54090 255696969 115 demo2
54091 255747474 115 demo2
try query.
select t2.sno, t2.codeseq, t2.lno, t2.docno tab1 t1 inner join tab2 t2 on t1.codeseq = t2.codeseq order t2.lno asc
Comments
Post a Comment