select distinct top 3 achi from T_achi where course=t.course order by achi desc 的条件 course=t.course 每个course查询一次。
where course=t.course 每个course的top3,不是一共top3,明白否?呵呵
(select distinct top 3 achi from T_achi where course=t.course order by achi desc ) ---这样写明显就是有可能重复才取出3个非重复的top 3依照你的前三名,假如相同的分数或者等级,你怎么取舍,这个规则要定下来,否则没得玩!
select top 3 * from T_achi t where achi in (select distinct top 3 achi from T_achi where course=t.course order by achi desc ) order by achi
where course=t.course 每个course的top3,不是一共top3,明白否?呵呵 ??不是很明白??这样应该是记录数乘3才对吧?? 它的查询步骤是怎样的呢?
where course=t.course
order by achi desc 的条件 course=t.course 每个course查询一次。
每个course的top3,不是一共top3,明白否?呵呵
where course=t.course
order by achi desc
)
---这样写明显就是有可能重复才取出3个非重复的top 3依照你的前三名,假如相同的分数或者等级,你怎么取舍,这个规则要定下来,否则没得玩!
where achi in (select distinct top 3 achi from T_achi
where course=t.course
order by achi desc
) order by achi
每个course的top3,不是一共top3,明白否?呵呵
??不是很明白??这样应该是记录数乘3才对吧??
它的查询步骤是怎样的呢?