SQL no. of student in class

本文由 hoho 在 2018-06-22 發表於 "WebSAMS 討論區" 討論區

標籤:
  1. 55065989

    hoho
    Expand Collapse

    文章:
    124
    讚:
    0
    I want a sql to count the number of student in each class as follows.
    Class No.of Student
    1A 29

    I don't know how to obtain the number of student, Anyone can help me?
     
  2. 55708113

    ptam
    Expand Collapse

    文章:
    107
    讚:
    0
    Have been using the following:

    select L.classcode 'Class',
    count(*) 'No of Student'
    FROM TB_STU_STUDENT S, VW_STU_LATESTSTUSCHREC L
    where L.STUID = S.STUID and L.SCHYEAR = '2017' and (L.status=null or L.status not in (4,5,6))
    group by L.CLASSLVL, L.classcode order by L.CLASSLVL
     
  3. 58019970

    edb-jackal
    Expand Collapse

    文章:
    465
    讚:
    0
  4. 55065989

    hoho
    Expand Collapse

    文章:
    124
    讚:
    0
    Thanks, But I want to know the meaning of
    L.status not in (4,5,6)
    what is inside the status field?
    What the number represent?
    thanks
     
  5. 55708113

    ptam
    Expand Collapse

    文章:
    107
    讚:
    0
    Under Code Management > Report

    4-Graduated,

    5-Departed

    6-Completed S3

    select classcode 'Class',
    count(*) 'No of Students'
    FROM VW_STU_LATESTSTUSCHREC
    where SCHYEAR = '2017' and (status=null or status not in (4,5,6))
    group by CLASSLVL, classcode order by CLASSLVL
     
  6. 55065989

    hoho
    Expand Collapse

    文章:
    124
    讚:
    0
    If I want more detail as
    Class Number of Boys Number of Girls Number of Students

    how to achieve it
     
  7. 58019970

    edb-jackal
    Expand Collapse

    文章:
    465
    讚:
    0
  8. 55065989

    hoho
    Expand Collapse

    文章:
    124
    讚:
    0
    Thanks a lot
     
  9. 55065989

    hoho
    Expand Collapse

    文章:
    124
    讚:
    0
    If I want more detail as
    Class number of student number of students left
    how to achieve it?
     
  10. 58019970

    edb-jackal
    Expand Collapse

    文章:
    465
    讚:
    0
    離開是什麼學生狀況?
    畢業? 離校 ?完成中三 ?還是都包括?
    請老師詳細說明,謝謝!
     
    #10 edb-jackal, 2018-06-27