************************************************************************************************************************************************************************************
答案為:
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)
************************************************************************************************************************************************************************************