i want write 1 query can check if payment done till certificate date.
e.g have 2 columns date.
certificatedate : 2016-03-26 lastpaymentdate : 2015-08-06
in case payment not done certificate date more last payment.so how can check condition , want record.
certificatedate : 2016-03-26 lastpaymentdate : 2016-04-15
in case payment done should not come in query results.
one can use datepart = month + year find difficulty in getting < or > query on record.
query : want records payment not done till march 2016. if certificate generated payment should till certificate date.
any appreciated.
if want compare year , month portions, can use date part functions. there 1 simple method:
where year(lastpaymentdate) * 100 + month(lastpaymentdate) <= 201603
however, think easier use date arithmetic:
where lastpaymentdate < '2016-04-01'
or
where lastpaymentdate < dateadd(day, 1, '2016-03-31')
Comments
Post a Comment