select distinct paykey,sum(payamt)as AmtDue
from payments
where datediff(month,payduedate,getdate())>=0
and payid='01101'
--just pulling one record normally leave this line out
Here is desired sample output
paykey AmtDue
0111 25
I used a date parameter of <=11/1/10 to pull records with a due date <=11/1/10
For record 01101, the getdate is todays date or 9/28/10
the paydue date is 10/1/10. For some reason record 01101 is not showing up. I believe the problem rests with the datediff formula. Any ideas
from payments
where datediff(month,payduedate,getdate())>=0
and payid='01101'
--just pulling one record normally leave this line out
Here is desired sample output
paykey AmtDue
0111 25
I used a date parameter of <=11/1/10 to pull records with a due date <=11/1/10
For record 01101, the getdate is todays date or 9/28/10
the paydue date is 10/1/10. For some reason record 01101 is not showing up. I believe the problem rests with the datediff formula. Any ideas