What I have is basically a problem which is easily solved with multiple tables, but I have only a single table to do it.
Consider the following database table
I think I have a solution that's different from the ones already proposed:
select * from foo where id = ( select id from foo F where F.bar = foo.bar order by F.baz limit 1 )
This gives you all the foo records that have the greatest baz compared to other foo records with the same bar.