Mysql工作持续总结
1.GROUP BY分组统计分组中某个值的数量
SELECT
SUM(CASE WHEN (address ='天津' AND is_retire = 1) THEN 1 ELSE 0 END) AS 天津退休人数
FROM USER GROUP BY 性别;
2.GROUP BY分组多个值分隔
, GROUP_CONCAT(c.name ORDER BY b.serial_num SEPARATOR '、') as pointOrder
1.GROUP BY分组统计分组中某个值的数量
SELECT
SUM(CASE WHEN (address ='天津' AND is_retire = 1) THEN 1 ELSE 0 END) AS 天津退休人数
FROM USER GROUP BY 性别;
2.GROUP BY分组多个值分隔
, GROUP_CONCAT(c.name ORDER BY b.serial_num SEPARATOR '、') as pointOrder