HI pls try below code
Select
C1,
C2,
C3,
C4,
case when (C1 + C2) = (C3 + C4) then 'Match'
else 'Unmatch' end as Result
From
(
Select
Row,
Max(C1) as C1,
Max(C2) as C2,
Max(C3) as C3 ,
Max(C4) as C4
From
(
Select
ROW\_NUMBER()
OVER (ORDER BY TABLE\_A.Field\_1) AS Row,
TABLE\_A.Field\_1 as C1
,TABLE\_A.Field\_2 as C2
,'0' as C3
,'0' as C4
From
TABLE\_A
Union ALL
Select
ROW\_NUMBER()
OVER (ORDER BY TABLE\_B.Field\_1) AS Row,
'0' as C1
,'0' as C2
,TABLE\_B.Field\_1 as C3
,TABLE\_B.Field\_2 as C4
From
TABLE\_B
)
as OuterTable
group by Row
) as FinalTable
n yes let me know which sql version u r using because in sql 2008 we have merge statement too... i hope this will help you ..
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi