Skip to Content
0
Mar 14 at 03:32 PM

Generate pairwise combinations in HANA SQL

173 Views Last edit Mar 15 at 02:37 PM 5 rev

Currently, I have a list of records that looks a bit like this (it is actually much longer)

image.png

I would like to generate all pairwise combinations of Field_B with the same value in Field_A.
If there is only one vleue in Field_B assigned to Field_A, no combination can be generated. Also, a combination of 2 identical vlaues in Field C and Field D in 1 record should not be generated.
The combinations would be stored in Field_C and Field D

The result would look like this

image.png

How can I create this result using HANA SQL?

Attachments

image.png (3.1 kB)
image.png (8.4 kB)