| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- -- ============================================================
- -- count(distinct ...) 测试
- -- ============================================================
- -- 1. count(distinct 单字段)
- select count(distinct a_category) from /test/aaa/test_aggr
- /**
- output()
- match("count(distinct a_category)","3")
- **/
- ;
- -- 2. count(distinct 数值字段)
- select count(distinct a_int) from /test/aaa/test_aggr
- /**
- output()
- **/
- ;
- -- 3. count(distinct bool 字段)
- select count(distinct a_bool) from /test/aaa/test_aggr
- /**
- output()
- match("count(distinct a_bool)","2")
- **/
- ;
- -- 4. count(distinct) + where
- select count(distinct a_category) from /test/aaa/test_aggr where a_bool=true
- /**
- output()
- **/
- ;
- -- 5. count(distinct) 空结果
- select count(distinct a_category) from /test/aaa/test_aggr where a_int=9999
- /**
- output()
- **/
- ;
|