Join several times
===

I've a table with fields `id_osztaly`, `id_csoportositas` and `name` (and some other fields but there aren't important).

I want create a query with the follow result: I want combine the `name` fields. I can't explain so I show an example:
the datas in the table (`id_osztaly`, `id_csoportositas` and `name` order):

    1,1,Group1A
    1,1,Group1B
    1,2,Group2A
    1,2,Group2B

I want the follow combine from `name`:

    Group1A-Group2A
    Group1A-Group2B
    Group1B-Group2A
    Group1B-Group2B

(similar the permutation). I can do this with a `JOIN`, it's ok. But when I three different value of `id_csoportositas`:

    1,1,Group1A
    1,1,Group1B
    1,2,Group2A
    1,2,Group2B
    1,3,Group3A
    1,3,Group3B
    1,3,Group3C

I want:

    Group1A-Group2A-Group3A
    Group1A-Group2A-Group3B
    Group1A-Group2A-Group3C
    Group1A-Group2B-Group3A
    Group1A-Group2B-Group3B
    Group1A-Group2B-Group3C
    Group1B-Group2A-Group3A
    Group1B-Group2A-Group3B
    Group1B-Group2A-Group3C
    Group1B-Group2B-Group3A
    Group1B-Group2B-Group3B
    Group1B-Group2B-Group3C

Yes, it's double join. But I don't know how many different `id_csoportositas` exist in table. First blick I think I need same number of `JOIN` as the number of different `id_csoportositas`.

Is there any trick in (my)sql to do this or should I do it in `PHP` with a `for`-cycle?