| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- -- ============================================================
- -- count() 各种形式测试
- -- ============================================================
- -- 1. count(*) 全表计数
- select count(*) from /test/aaa/test_aggr
- /**
- output()
- match("count(*)","7")
- **/
- ;
- -- 2. count(1)
- select count(1) from /test/aaa/test_aggr
- /**
- output()
- **/
- ;
- -- 3. count(字段)
- select count(a_int) from /test/aaa/test_aggr
- /**
- output()
- **/
- ;
- -- 4. 带 where 条件的 count
- select count(*) from /test/aaa/test_aggr where a_category='category_a'
- /**
- output()
- match("count(*)","3")
- **/
- ;
- -- 5. count 空结果集
- select count(*) from /test/aaa/test_aggr where a_category='non_exist_category'
- /**
- output()
- match("count(*)","0")
- **/
- ;
- -- 6. count 多个字段
- select count(a_name), count(a_int) from /test/aaa/test_aggr
- /**
- output()
- **/
- ;
- -- 7. count 带 bool 条件
- select count(*) from /test/aaa/test_aggr where a_bool=true
- /**
- output()
- match("count(*)","4")
- **/
- ;
|