Use a simple group by id_member, but select:
substring(max(concat(from_unixtime(timestamp),attendance)) from 20) as attendance
This attaches attendance to the timestamp for each row in a group, in order to be able to select the desired timestamp/attendance with max() and then extract just the attendance.
What concat()
returns is 19 characters of formatted timestamp (YYYY-mm-dd HH:MM:SS) with the attendance appended starting at character 20; the substring(... from 20)
gets just the attendance from the (stringwise) maximum one for the group. You can remove the group by and just
select concat(from_unixtime(timestamp),attendance), timestamp, attendance
to get a better idea of how it uses max to get the right attendance.