SQL 請問如何抽取級及班首3名?

本文由 山崔老師 在 2021-01-04 發表於 "WebSAMS 討論區" 討論區

  1. 55020632

    山崔老師
    Expand Collapse

    文章:
    3
    讚:
    0
    請問如何快速抽取各級和各班首3名
     
    #1 山崔老師, 2021-01-04
  2. 58521906

    edb-catherinewschan
    Expand Collapse

    文章:
    191
    讚:
    0
    你好,

    你可以試下這個...

    select
    c.CLASSLEVEL,
    d.CH_DES,
    a.CLASSCODE,
    a.CLASSNO,
    a.CHNAME,
    c.SYSSCORE,
    c.omclass
    from wsadmin.TB_ASR_SUBJASSESSDATA c
    join wsadmin.TB_HSE_COMMON d
    on d.SUID = c.SUID and c.SCHYEAR = ? and c.TIMESEQ = ? and c.omclass <=3 and d.TB_ID = 'SBJ' and c.SUBJCODE = d.CODE_ID and c.CLASSLEVEL = ?
    join wsadmin.TB_ASR_CLSLVLSUBJSETTING e
    on c.SUID = e.SUID and c.SCHYEAR = e.SCHYEAR and c.SCHLEVEL = e.SCHLEVEL and c.SCHSESSION = e.SCHSESSION and
    c.CLASSLEVEL = e.CLASSLEVEL and c.SUBJCODE = e.SUBJCODE and c.TIMESEQ = e.TIMESEQ and c.MOI = e.MOI and e.BYGRADEIND = 'N'
    join wsadmin.VW_STU_LATESTSTUDENT a
    on a.SUID = c.SUID and a.STUID = c.STUID and a.SCHYEAR = c.SCHYEAR
    order by a.SCHSESS, c.CLASSLEVEL, a.CLASSCODE, d.EN_DES, c.OMCLASSLVL, a.CLASSNO
     
    #2 edb-catherinewschan, 2021-01-05