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 termsHi 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
No comments:
Post a Comment