I have a repeated value on Bigquery, example: {"a": 1, "b": 4, "c": 6, "d": 8}
From this, I want every possible combination of two. So the output I'd be looking for is {"aa", "ab", "ac", "ad", "ba", "bb", "bc", "bd", "da", "db", "dc", "dd"}. The labels used here are of size 1, but the real labels will be strings of length between 6 - 50.
For this particular use case, I do not actually care about the values of these labels. I will group by this label and do a count.
So the columns for my final output will look something like this:
date, first_value, second_value, total
2020-01-01, a, a, 1
2020-01-01, a, b, 1
...
How can I go about doing this?