mysql group_concat [BLOB -5B]结果

时间:2013-12-27 12:25:00

标签: mysql concat

SELECT model as model,colorpack.colorID as color
FROM bags LEFT OUTER JOIN colorpack on bagsID=colorpack.colorpack
WHERE colorpack.colorpack='62'

这个选择给我这样的东西:

model     | color
------------------
CoolModel |  26
CoolModel |  28

我需要这个:

model     | color
------------------
CoolModel |  26,28
So i try to use GROUP_CONCAT:
    SELECT model as model,GROUP_CONCAT(colorpack.colorID) as color
    FROM bags LEFT OUTER JOIN colorpack on bagsID=colorpack.colorpack
    WHERE colorpack.colorpack='62'

但后来我得到了:

model     | color
-------------------------
CoolModel |  [BLOB - 5 B]
After google/stackoverflow research i found that maybe max value is problem, but after:
    show variables like "%concat%";
Variable_name           | Value
--------------------------------
group_concat_max_len    | 1024

所以我认为不是这样,还有其他任何建议吗?

编辑: 如果我选择varchar,相同的代码工作,但是当我选择tinyint时,它不起作用。

1 个答案:

答案 0 :(得分:0)

您尝试GROUP_CONCAT但未在查询中使用GROUP BY可能是问题,请尝试此操作:

SELECT model as model,GROUP_CONCAT(colorpack.colorID) as color
FROM bags LEFT OUTER JOIN colorpack on bagsID=colorpack.colorpack
WHERE colorpack.colorpack='62' GROUP BY model