求教取各部门前5名的SQL select top 5 dep from table order by amount desc 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select *from tablename awhere amount in (select top 5 amount from tablename where a.dpt = dpt) select *from tablename temwhere amount in (select top 5 amount from tablename where dpt =tem.dpt order by amount desc) select * from 表名 tem where item in (select top 5 item from 表名 where dpt=tem.dpt order by amount desc) select top 5 from table select top 5 from table select top 5 * from tablename order by amount desc select * from table a where item in (select top 5 item from table where dpt=a.dpt order by amount desc) select * from tablename awhere amount in (select top 5 amount from tablename where a.dpt = dpt order by amount desc) select * from tablename awhere item in (select top 5 item from tablename where a.dpt = dpt order by amount desc) 主从表查询 今天找到了解锁sql server2005的存储过程,但不知道如何运行? 这段存储过程哪里出错了? 有一个视图查询问题! 只知道一个值,不知道是哪个字段和哪张表的,请问该如何查询? 列转行失败 SQL_Sever2005字符串的应用 急诊!我想把数据库中的一个表导入或导出到另外一个数据库的表中,用SQL语句如何实现? 请教诸位高手,应该怎样把用ACCESS做的库转到SQL那边? 用户登录判断采用那种方式?请帮我选择一下吧 如何用grant将存储过程付给角色上面。。。。。 如何根据整合三个表的数据!急!
from tablename a
where amount in (select top 5 amount from tablename where a.dpt = dpt)
from tablename tem
where amount in (select top 5 amount from tablename where dpt =tem.dpt order by amount desc)
where amount in (select top 5 amount from tablename where a.dpt = dpt order by amount desc)
where item in (select top 5 item from tablename where a.dpt = dpt order by amount desc)