select version as 版本 from cbas_eventdata; 所有 select DISTINCT version as 版本 from cbas_eventdata; 去重 select DISTINCT min( version) as 版本 from cbas_eventdata; 取最小 select count(DISTINCT VERSION) as 版本种类总数 FROM cbas_eventdata ; 版本总类总数 select DISTINCT version as 版本 from cbas_eventdata ORDER BY 版本 ; 结果升序 select DISTINCT version as 版本 from cbas_eventdata ORDER BY 版本 DESC ; 结果降序 这列的总数: SELECT count() from cbas_eventdata where version like '%%'; SELECT count() from cbas_eventdata where version is not NULL; SELECT count(DISTINCT version) from cbas_eventdata; select count(*) FROM cbas_eventdata where clientdate < '2017-04-17 '; 查询4月17前的个数

select * from moncenter.dbo.wt_login_transmid where version = 'I037.08.146.1.13.0' or version = 'G037.08.55.1.32.9.00' 列出这两个版本的所有信息 select count(*) as 版本 from moncenter.dbo.wt_login_transmid where version = 'I037.08.146.1.13.0' or version = 'G037.08.55.1.32.9.00' 以版本为列标题统计这两个版本的数量 select count(distinct version) as 版本 from moncenter.dbo.wt_login_transmid where version = 'I037.08.146.1.13.0' or version = 'G037.08.55.1.32.9.00' 以版本为列标题统计这两个版本去重后的数量(肯定就是2)

select distinct dlzh from moncenter.dbo.wt_login_transmid where exists (select * from moncenter.dbo.wt_login_transmid where version = 'I037.08.146.1.13.0' or version = 'G037.08.55.1.32.9.00' ) 列出这两个版本的登陆账户,去重列出,用到嵌入查询exists

select distinct phone as 手机号 ,dlzh as 登陆账户 from moncenter.dbo.wt_login_transmid where exists (select * from moncenter.dbo.wt_login_transmid where version = 'I037.08.146.1.13.0' or version = 'G037.08.55.1.32.9.00' ) 列出这两个版本的登陆账户及手机号,手机号和登陆账户关联去重,用到嵌入查询exists

查询年薪高于奖金10倍的所有人信息: selelct * from userinfo where nx > jj*10;