用SQL抽出每科學期進步最多的學生

本文由 有心人 在 2016-07-05 發表於 "WebSAMS 討論區" 討論區

標籤:
  1. 10956881

    有心人
    Expand Collapse

    文章:
    47
    讚:
    0
    各位同工:

    請問如何修改以下SQL抽出每科學期進步最多的首3名學生,謝謝.

    select
    a.CLASSLVL,
    a.CLASSCODE,
    a.CLASSNO,
    b.CHNAME,
    e.en_des 'Subject',
    e.ch_des '科目',
    c.SYSSCORE 'T1_Score',
    d.SYSSCORE 'T2_Score',
    T2_SCORE-T1_SCORE 'Differenct'
    from wsadmin.VW_STU_LATESTSTUSCHREC a
    join wsadmin.TB_STU_STUDENT b
    on a.SUID = b.SUID and a.STUID = b.STUID and a.SCHYEAR = ? and a.CLASSLVL = ?
    join wsadmin.TB_ASR_SUBJASSESSDATA c
    on a.SUID = c.SUID and a.STUID = c.STUID and a.SCHYEAR = c.SCHYEAR and
    c.TIMESEQ = 1100 and c.SYSSCORE is not null
    join wsadmin.TB_ASR_SUBJASSESSDATA d
    on a.SUID = d.SUID and a.STUID = d.STUID and a.SCHYEAR = d.SCHYEAR and
    d.TIMESEQ = 1200 and c.SUBJCODE = d.SUBJCODE and c.MOI = d.MOI and
    d.SYSSCORE is not null
    left outer join tb_hse_common e
    on a.suid=e.suid and c.subjcode=e.code_id and e.tb_id='SBJ'
    order by 1, 5, 9 desc
     
    #1 有心人, 2016-07-05
  2. 58019970

    edb-jackal
    Expand Collapse

    文章:
    465
    讚:
    0
    由於進步分差沒有排名這項數據,所以未能修改SQL以抽出首3名學生。
    但老師可以使用以下SQL語句,以減少沒有進步的數據:

     
    #2 edb-jackal, 2016-07-05