返回顶部

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

 

posted @ 2022-09-08 16:07  不懒人  阅读(19)  评论(0编辑  收藏  举报