我有一个问题是 想写一条SQL语句,用count 和 distinct 意思是想 返回 count 值同时又能用distinct 返回 表
比如:
select count(distinct hello )
from Tb
只能返回 count值
但我又想 用这条语句 select distinct hello from Tb 查询表
能不能用这2条语句 合在一起写啊 本人比较笨 自己试了 写不出 请高手 新年 新赐教 谢谢
比如:
select count(distinct hello )
from Tb
只能返回 count值
但我又想 用这条语句 select distinct hello from Tb 查询表
能不能用这2条语句 合在一起写啊 本人比较笨 自己试了 写不出 请高手 新年 新赐教 谢谢
from (select distinct hello
from Tb
)
from Tb) m, tb n
select distinct hello,count(distinct hello) as cnt from Tb group by hello