select top 1 教师名字,count(*) as 授课数
from t
group by 课程名
order by 授课数 desc
from t
group by 课程名
order by 授课数 desc
解决方案 »
- sql server 2008 r2的数据库,能够给 sql server 2008的服务器使用吗?
- 我遇到一个数据库查询的问题,请大家帮我。
- 查找父节点
- 用友财务通用户名无法设密码,随便装个客户端软件就能看数据库,怎么办呀?
- 请问:如何根据访问量确定采用的服务器数量?
- 一个估计烂了的SQL问题
- 关于传输recordset的问题
- 我现在碰到一个问题:数据库在服务器上,我要在本地机器查数据库的数据,而且 是经常性的,固定内容的查询,用什么办法呢
- 在线等待,对拉,马上给分!!
- sqlserver数据库的数据回复问题???
- 一个关于“触发器”的实例问题,给100分!!急啊
- 蛙蛙请教:t-sql函数问题
from t
group by 教师名字
order by 授课数 desc
课程名 授课地点 教师名字
A 1 a
B 2 c
C 1 a
d 2 b
E 3 NULL
from t
group by 课程名
order by 教师名字 desc,授课数 desc
from t
group by 课程名
order by 授课地点 desc,授课数 desc
select distinct 教师名字
from 表 a
where not exists(select 1 from 表 b
where (select count(distinct(课程名)) from 表 where 教师名字=b.教师名字)
>(select count(distinct(课程名)) from 表 where 教师名字=a.教师名字)
)
from t
group by 教师名字
where 教师名字 is not null --去空值
order by 授课数 desc
在SQL中我每次都用 where ISNULL(字段1,0)=0 作为判断条件,这个太不方便了.
as
select count(*) c,dd from 表1
group by 教师名字select max(c) from k
其实lsxaa(小李铅笔刀) 的方法已经可以了。
from t
where 教师名字 is not null --去空值
group by 教师名字
order by 授课数 desc
from t
where 教师名字 is not null --去空值
group by 教师名字
order by 授课数 desc
顺序 放错了,,呵呵呵 用这个吧
可能是我对TOP用法不了解吧.
我再看看帮助