-2

如何找到一个具有负值而另一个具有相同正值的记录。我已经尝试过这个和类似的东西,但它们不起作用。

 where [Check_Number]=[Check_Number] and Payment_Amount = ([payment_amount]/-1)
4

1 回答 1

0

这个怎么样:

where a.check_Number + b.check_number = 0 and a.check_number < 0

或者,这两个字段是 payment_amount 和 check_number 吗?

where payment_amount = - check_number and check_number < 0

也许是这样的?

select r1.check_number, r1.payment_amount, r2.check_number, r2.payment_amount
from records r1 join
     records r2
     on r1.check_number = r2.check_number and
        r1.payment_amount = - r2.payment_amount
于 2013-02-26T15:38:46.690 回答