I have been working on similar problem but my sql translation does not look god for now.
Sorry for terrible question bot for now I have no idea how to find good solution.
select event, logonsource, username, max(logontime) from log_TABLE group by username, event
I have the same communicate like friend from first post.
Select failes 353: Selected non-aggregate values must be part of the associated group.
Can I youse som of your help?