You can do something like this:select isnull(t1.Acct,t2.Acct) as Acct, isnull(t1.Cusip,t2.Cusip) as Cusip, t1.Quantity, t2.Quantity, isnull(t1.Quantity,0) - isnull(t2.Quantity,0) as Difffrom Table1 t full join Table2 t2 on t1.Acct = t2.Acct and t1.Cusip = t2.Cusipwhere t1.Quantity is null or t2.Quantity is null or t1.Quantity <> t2.Quantity
Edit: This would also find Cusips that exist in one table but not in the other. If you did not want that - that is, you want to get ONLY cusips that exist in both tables, change the "full join" to "inner join"