开发者

mysql returning incorect string ...

Hy ... i'm try开发者_高级运维ing to group_concat the primary key (id) like this : SELECT GROUP_CONCAT (id) AS idz FROM table_name GROUP BY group; but the result is [BLOB - 5 Bytes] instead of 12,13,16,22.

Why ?

Thank you


Try

SELECT group_concat(cast(id as char) SEPARATOR ',') as idz
FROM table_name
GROUP BY `group`


Have a look here.

according to the group by documentation The return value is a nonbinary or binary string, depending on whether the arguments are nonbinary or binary strings. The result type is TEXT or BLOB

http://dev.mysql.com/doc/refman/5.0/en/blob.html

It may be that you're result is best represented as a BLOB.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜