板块的类型是有限的话,是不是可以用case when?
select sum(case when s_type = ‘主板’ than s_cnt else 0 end) '主板数量’,
       sum... 中小板数量,
       ...
group by s_date;
 
【 在 amw 的大作中提到: 】
: 我在MYSQL里查询结果如下(用到了group)
  s_date                  s_type  s_cnt 
: 2023-01-03 00:00:00     主板    3902
: 2023-01-03 00:00:00     中小板  1985
: ...................
--
FROM 222.128.31.*