位字段上的group_concat()在Mysql中返回垃圾

时间:2016-06-20 10:15:44

标签: mysql

表格结构

CREATE TABLE `academicyears` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `campusid` int(11) DEFAULT NULL,
  `academicyear` text NOT NULL,
  `month` tinyint(4) DEFAULT NULL,
  `flag` bit(1) DEFAULT b'1',
  PRIMARY KEY (`id`)
);

我的查询

SELECT GROUP_CONCAT(ay.`flag`) 
FROM academicyears ay
GROUP BY ay.`campusid`

结果

enter image description here

1 个答案:

答案 0 :(得分:2)

试试这个;)

SELECT GROUP_CONCAT(ay.`flag` + 0) 
FROM academicyears ay
GROUP BY ay.`campusid`

并查看参考here