一般的,我们会在where, 或者 having中加条件,count中只是某个字段

今天看到另外一种写法,不知道性能怎么样

select 

count(  case    when xxx>10 and yyy<99 then bbb else null end)  cm1,

count(  case    when xxx>20 and yyy<1 then ccc  else null end)  cm2

from xxxx

基本原理是 使用了数据库count(null)时返回的是0 count(非null)返回是1

@Flink SQL

相关文章:

  • 2021-10-23
  • 2021-11-06
  • 2022-12-23
  • 2021-12-11
  • 2021-10-02
猜你喜欢
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案