Return all possible combinations for each group
if your dataset is small, something like this could be suitable:

select class1.id ,class1.class class1,class2.class class2 from 
t1 class1,
t1 class2
where
class1.id = class2.id and
class1.class &lt; class2.class
order by id,class1,class2