Your question is very unclear. If i understand your question correctly, this is what you want right? You didn’t mention to SUM
up the values in Field3 or MAX
, MIN
or etc.
SELECT Field1, Field2, Group_Concat(Field3)
FROM tableName
GROUP BY Field1
Result:
Field1 Field2 Field3
a x 10, 20
b g 30, 40
c u 50, 60
UPDATE
as i read the comment, you want this query:
SELECT group_concat(Distinct Field1),
GROUP_CONCAT(DISTINCT Field2),
GROUP_CONCAT(Field3)
FROM tableName;
will Result:
Field1 Field2 Field3
a,b,c x,g,u 10, 20 , 30, 40, 50, 60
3
solved How do I group two column but return all three column value from single table