Yes it does. You need to use a programming language like perl I expect, to handle this. I don't think you can do everything you want with just an SQL query.
You'd probably want to do a SELECT DISTINCT(UserID) From Table and then loop the results and within the loop perform a select on the Group column using the user id for the current loop iteration - that would grab all the groups for each user - you would then store them in a perl structure like a hash.
You'd probably want to do a SELECT DISTINCT(UserID) From Table and then loop the results and within the loop perform a select on the Group column using the user id for the current loop iteration - that would grab all the groups for each user - you would then store them in a perl structure like a hash.