How to get latest date from fees table and compare it to current date in mysql
Try this

select  members.name , fees.todate ,
fees.usercode
from members
INNER JOIN 
(
select max(usercode) as usercode
, memberid
, max(todate) as todate
from
fees    
WHERE
 fees.usercode ='KMTS472895'
 GROUP BY fees.memberid
) as fees
on members.memberid = fees.memberid
where fees.todate &lt; curdate()
order by members.memberid