Reputation: 15
I have two tables, Main and detail with are linked togeather. The output would be somethink like this:
Records found: 8
mail.field detail.Field
A x
A y
A z
B i
B j
C l
C m
C n
Is it possible to "concat" all detail-Valus to geht this result
Records found: 3
A x+y+z
B i+j
C l+m+m
Upvotes: 1
Views: 27
Reputation: 15
select main_field, group_concat(detail.Field order by detail.Field SEPARATOR '+')
from tablename
JOIN .....
group by main_field
Upvotes: 0
Reputation: 37483
You can use group_concat()
select main_field, group_concat(detail.Field order by detail.Field SEPARATOR '+')
from tablename
group by main_field
Upvotes: 3