Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Question Unanswered: Brand New to SQL and Programing

    Hi Everyone

    I am learning SQL using the "Trial by Fire" method.

    The program is based on Pascal and SQL. The database responds to SQL statements. This is a propriety program. The operating system is NT 4.0.

    <Problem>
    I need to count the number of each type of EnrolStatus for this class.


    <Tables Set-Up>
    Table Name: Registration
    Field Names: EnrolStatus
    Field Names: Class_OID

    The EnrolStatus is broken down into 4 groups
    0=enrolled
    1=finished
    2=cancelled
    3=No Show

    The class OID is 1300

    <Tried but didn't work>

    SELECT * FROM REGISTRATION WHERE REGISTRATION.CLASS_OID = 1300 AND
    Recordcount(*) REGISTRATION.EnrolSTATUS = 1

    I am hoping someone can help me.

    Forgive me if I didn't state everything with the right terms

  2. #2
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Hi mlscw,

    To count the number of each type of EnrolStatus of the class. You will need to use the GROUP BY clause and then take the COUNT.

    select enrolstatus, count(*)
    from registration
    where class_oid = 1300
    group by enrolstatus


    HTH
    Cheers,
    Shev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •