答案 0 :(得分:0)
我不太确定,但我认为你需要ISNULL而不是。你可以试试这个:
VoucherId = '2000702' AND PosDateEntered!= NULL
如果您需要更多帮助,这可能有所帮助: SQL - don't display row when two criteria are met
答案 1 :(得分:0)
这是我的解决方案。
create table test
(
voucherid int,
posdateentered datetime,
valueissued int,
valueredeemed int,
rvtransactionamount decimal(9,3)
)
insert into test values (2000702, null, 5, 0, -5.00)
insert into test values (2000702, '4/2/2016', 5, 0, 5.00)
select distinct t1.voucherid, t2.posdateentered,
t1.valueredeemed, t1.rvtransactionamount
from test t1
left join test t2 on t1.voucherid = t2.voucherid
where t2.posdateentered is not null