SELECT 0 as status,COUNT(*) as statistic, 'name1' AS copy FROM table WHERE status=0 UNION ALL
SELECT 1 as status,COUNT(*) as statistic, 'name2' AS copy FROM table WHERE status=1 UNION ALL
SELECT 2 as status,COUNT(*) as statistic, 'name3' AS copy FROM table WHERE status=2 UNION ALL
SELECT 3 as status,COUNT(*) as statistic, 'name4' AS copy FROM table WHERE status=3 UNION ALL
SELECT 4 as status,COUNT(*) as statistic, 'name5' AS copy FROM table WHERE status=4
sql自定义列名字统计数据
最新推荐文章于 2024-09-23 09:14:08 发布