select max(id).... group by email