Chciałbym pogrupować elementy według nazw + przyporządkowanych operacji i niby mogę stworzyć taki string jak operations z outputu przy pomocy concat, ale group by już z tym nie współpracuje. Ma ktoś jakiś pomysł jak to ugryźć?
element
id | name |
---|---|
1 | A |
2 | A |
3 | B |
4 | B |
operation
id | element_id | operation |
---|---|---|
1 | 1 | operation1 |
2 | 1 | operation2 |
3 | 2 | operation1 |
4 | 2 | operation2 |
5 | 3 | operation1 |
output
element_name | operations | quantity |
---|---|---|
A | operation1,operation2 | 2 |
B | operation1 | 1 |
B | null | 1 |