Hi,I have a table CREATE TABLE [dbo].[Payments]( [id] [int] NULL, [paymentsum] [int] NULL, [fromdate] [date] NULL, [untildate] [date] NULL, [customerid] [int] NULL) ON [PRIMARY]. id paymentsum fromdate untildate customerid1 0 2009-02-20 2014-02-20 903452 0 2010-04-12 2013-02-20 903453 100 2011-08-24 2011-09-24 903454 100 2008-09-30 2013-02-09 90345
I need to find customers that have paymentsum=100 and that have no untildate>getdate. If a customer does have one row for 100 where untildate>100 then I don't need to show that.Any thoughts? Should I do it with EXISTS?Thanks