SELECT m.user_id, u.username, sum(p.value) as lpoint,FROM_UNIXTIME(p.datetime,"%Y-%m"),year(current_timestamp()),month(current_timestamp())
from gy_member as m
LEFT JOIN gy_user as u on u.id=m.user_id
INNER JOIN gy_point_log as p on p.user_id=m.user_id and p.value>0
and FROM_UNIXTIME(p.datetime,"%Y-%m")=(case when month(current_timestamp())>1
then (CONCAT(year(current_timestamp()),'-',month(current_timestamp())-1))
else (CONCAT(year(current_timestamp())-1,'-',12)) end)
GROUP BY m.user_id