-1

I will better explain with tables:

table size

-----------------------------
id | type | size | cont_id  |
-----------------------------
 1 |  GP  |  30  |     21   |
 2 |  FR  |  30  |     21   |
 3 |  UP  |  40  |     21   | 
 4 |  GT  |  50  |     32   |
 5 |  UP  |  40  |     32   |
-----------------------------

table buy

-------------------
cont_id | cus_nam |
-------------------
 21     |   xxx  | 
 32     |   zzz  |
------------------

Now I want to combine two column into one and then do group_concat

This is what I want to do, output table should be like this:

------------------------------------
      type          |     cont_id  |
-----------------------------------
  30GP ,30FR,40UP   |    21        |
    50GT , 40UP     |    32        |
------------------------------------
Munna Babu
  • 5,496
  • 6
  • 29
  • 44

1 Answers1

2

You only need the first table. This is almost a basic aggregation:

select group_concat(size, type), cont_id
from size
group by cont_id;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • GROUP_CONCAT(offer_details.size, offer_details.type) as 'size' its not working its shows syntax error. i m doing left join three tables – Munna Babu Apr 22 '15 at 12:21
  • @Munna . . . We can only answer the question that is asked. Ther eis no `offer_details` table in the question. In fact, the answer to the question only needs the first table. If you have a different question, then ask it as a *new* question. It is impolite to change a question and invalidate already completed answers. – Gordon Linoff Apr 22 '15 at 21:56