表名:table
注意,就是安组合并,
为何我得到的是
BLOB

解决方案 »

  1.   

    select  mind(concat(color,'=',qty) SEPARATOR '||')
    from tb
    group by wc
      

  2.   

    SELECT wc,
    CAST(GROUP_CONCAT(CONCAT(color,'=',qty) SEPARATOR '||') AS CHAR) FROM tt4 GROUP BY wc
      

  3.   

    select wc,GROUP_CONCAT(CONCAT(color,'=',qty) SEPARATOR '||') 
    from 表名
    group by wc
      

  4.   


    create table csdn_0510_1(
    id int not null auto_increment primary key,
    wc varchar(30),
    color varchar(30),
    qty int
    );
    insert into csdn_0510_1(wc,color,qty)
    select 'aa','s1',12 union all
    select 'bb','s3',2 union all
    select 'bb','s7',3 union all
    select 'bb','s9',4 union all
    select 'cc','s22',6 union all
    select 'dd','s3',7 union all
    select 'dd','s4',1;
    select wc,group_concat(concat(color,'=',qty)SEPARATOR'||')
    from csdn_0510_1
    group by wc
      

  5.   

    mysql> select id,wc,group_concat(concat(color,'=',qty) separator '||') color from a group by wc;
    +----+------+------------------+
    | id | wc   | color            |
    +----+------+------------------+
    |  1 | aa   | s1=12            |
    |  2 | bb   | s3=2||s7=3||s9=4 |
    |  5 | cc   | s22=6            |
    |  6 | dd   | s3=7||s4=1       |
    +----+------+------------------+