************************************************************************************************************************************************************************************



答案为:
select * from hard a
where je in(select top 2 je from hard b where a.qu=b.qu order by je)
************************************************************************************************************************************************************************************
统计查询的两种思路:
(1)、查询选修课程超过5门的学员号和所属单位
答案为:
select sn ,sd from s
where s# in(select s# from sc group by s# having count(distinct c#)>5)
(2)、
************************************************************************************************************************************************************************************

答案有错,纠正为:
select distinct a.*
from dbo.hc a left join dbo.hc b
on a.主叫号码=b.主叫号码
where a.id<>b.id and (datediff(second,a.通话起始时间,b.通话结束时间)>10)
and datediff(second,b.通话结束时间,a.通话起始时间)>10)
************************************************************************************************************************************************************************************
本文介绍了三种SQL查询案例,包括跨表取前N条记录、查询选修课程超过五门的学生信息及电话通话记录关联匹配查询。通过具体示例展示了如何使用SQL解决实际问题。
1139

被折叠的 条评论
为什么被折叠?



