you could try order by and group by. It's not really what it's meant for, but it might work. I accidentally did this just yesterday while playing with a query, I ended up with a result set similar to what you're looking for. Also, you might want to look further into it, because the result set might not be guaranteed.