0

I need to print the select values in just one column, here the data:

 mysql> select DATE_FORMAT(STR_TO_DATE(items.date, '%Y-%m-%d'), '%M %d,  %Y') date_new, unit, Descpt, p_cost, add_by, GROUP_CONCAT(color,' = ',qty) as COLOR, SUM(qty) as Total, SUM(qty) * p_cost as Ptotal from items where status IN ('1','2') Group By Descpt;
  +---------------+------+------------------------+--------+--------+-------           -------------------------------------------------------------------------------          --------------------------------------------------------------------------------     --+-------+--------+
  | date_new      | unit | Descpt                 | p_cost | add_by | COLOR                                                                                                                                                                        | Total | Ptotal |
  +---------------+------+------------------------+--------+--------+----      --------------------------------------------------------------------------------      --------------------------------------------------------------------------------      -----+-------+--------+
  | June 16, 2016 | Pcs  | #1688N - Big Crate New | 125.00 | Psd    | BLUE - W = 200,BLUE - W/O = 400,RED - W/O = 300,RED - W = 500,GREEN - W = 366,GREEN - W/O = 278,YELLOW       - W = 472,YELLOW        - W/O = 582,BLACK - W = 255,BLACK - W/O = 330 |  3683 | 460375 |
  +---------------+------+------------------------+--------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+--------+

Like this sample:

sample

Termininja
  • 6,620
  • 12
  • 48
  • 49
Psd
  • 25
  • 7
  • I think you're confusing data storage and retrieval with data display. – Strawberry Aug 08 '16 at 14:23
  • I mean COLOR values will be selected by its own color, like blue - w | blue - w/o | red -w | red - w/o...and its own qty... – Psd Aug 08 '16 at 14:51
  • Edit your question plz to make it clear like this. http://stackoverflow.com/questions/13451605/how-to-use-group-concat-in-a-concat-in-mysql/13451984#13451984. Hope you will find the answer as well. If you don't. Then ask clear plz with a sample existing data and sample output, i will guide – Sami Aug 16 '16 at 19:40

0 Answers0