2
Using SQL I am making a record that I will give a SELECT in a database in which some records comes duplicated which is structured as follows with the same adhesion ex:
+------------+-------------+-------------+
| ADE | COLUMN_NAME | IS_IDENTITY |
+------------+-------------+-------------+
| caio | 3 | 10 |
| caio | 4 | 4 |
| caio | 4 | 8 |
+------------+-------------+-------------+
and I want to group the data as follows in the same cell, in which the divergence will be concatenated with the Idmotivo separated by " - " and the reasons for the divergence by "," and for the grouping of divergences by "|" being as follows ex:
+------------+-------------+-------------+
| ADE | DIVERGÊNCIA - MOTIVO |
+------------+-------------+-------------+
| caio | 3-10 | 4-4, 8 |
+------------+-------------+-------------+
I tried to use GROUP and PIVOT together, but I don’t know how to use it well.