

select count(), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(*), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(id), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

-- 不支持这种写法 distinct 后面必须带字段名
select count(distinct), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
onerror(continue,"not exist")
noerrinfo()
**/
;

select count(distinct *), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(distinct *), v_chars as "文字" from /test/foo 
group by v_chars having count(distinct *) > 1 and count(distinct id) < 4
order by "文字" desc
/**
output()
count(2)
match('文字','c',count,3)
match('文字','b',count,2)
**/
;

select count(distinct id), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;


select count(distinct id), v_chars as "文字" from /test/foo 
group by v_chars having count(distinct id) > 2
order by "文字" desc
/**
output()
count(2)
match('文字','d',count,4)
match('文字','c',count,3)
**/
;

select count(distinct v_chars), v_chars as "文字" from /test/foo 
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,1)
match('文字','c',count,1)
match('文字','b',count,1)
match('文字','a',count,1)
**/
;

select count(distinct xx.v_chars), xx.v_chars as "文字" from /test/foo xx
group by xx.v_chars order by "文字" desc
/**
output()
match('文字','d',count,1)
match('文字','c',count,1)
match('文字','b',count,1)
match('文字','a',count,1)
**/
;

select count(), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(*), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(id), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(distinct), v_chars as "文字" from
(select v_chars, id as distinct from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(distinct *), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(distinct id), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,4)
match('文字','c',count,3)
match('文字','b',count,2)
match('文字','a',count,1)
**/
;

select count(distinct id), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars having count(distinct id) > 2
order by "文字" desc
/**
output()
count(2)
match('文字','d',count,4)
match('文字','c',count,3)
**/
;

select count(distinct v_chars), v_chars as "文字" from
(select * from /test/foo) xx
group by v_chars order by "文字" desc
/**
output()
match('文字','d',count,1)
match('文字','c',count,1)
match('文字','b',count,1)
match('文字','a',count,1)
**/
;

select count(distinct xx.v_chars), xx.v_chars as "文字" from 
(select * from /test/foo) xx 
group by xx.v_chars order by "文字" desc
/**
output()
match('文字','d',count,1)
match('文字','c',count,1)
match('文字','b',count,1)
match('文字','a',count,1)
**/
;

select count(distinct v_float) ,count(distinct v_text) FROM  /test/basic
/**
output()
match("count",2)
match("count_1",5)
**/
;

select count(distinct v_float) as  Aa,count(distinct v_text) FROM  /test/basic
/**
output()
match("Aa",2)
match("count",5)
**/
;

select count(distinct aa.v_float) as Aa,count(distinct v_text) FROM (select * from /test/basic) aa
/**
output()
match("Aa",2)
match("count",5)
**/
;

select count(distinct v_float) ,count(distinct v_text) FROM  (select * from /test/basic) aa
/**
output()
match("count",2)
match("count_1",5)
**/
;





