Hi all, using these tables, Im trying to write a query that will list the students that have taken any type of class (class_level) and how many of that particular type they have taken so using a count of somekind.

Tables:

ATTAIN
PK FK Rank_Num      integer     refers to RANK
PK FK Stu_Num       integer     refers to STUDENT
     Rank_Date      date        

RANK
PK  Rank_Num        integer
    Rank_Name       string
    Rank_Belt       string

REQUIREMENT
PK  Req_Num     integer
FK  Rank_Num        integer     refers to RANK
    Reg_Descript        string      

STUDENT
PK  Stu_Num     integer
    Stu_FName       string
    Stu_LName       string
    Stu_Initial     char
    Stu_DOB     date
    Stu_Join_Date       date    

ATTENDANCE
PK FK   Meet_Num        integer     refers to MEETING
PK FK   Stu_Num     integer     refers to STUDENT
    Attend_Role     string

MEETING
PK  Meet_Num        integer 
FK  Class_ID        integer     refers to CLASS
NN  Meet_Instruct       integer     refers to INSTRUCTOR (to account for every meeting needs an assigned instructor)
    Meet_Date       date

INSTRUCTOR
PK FK   Stu_Num     integer     refers to STUDENT
    Inst_Hire_Date  date
    Inst_Status     string      (compensated or volunteer)

CLASS
PK  Class_ID        integer
    Class_Weekday   string  
    Class_Time      time
    Class_Location  string
    Class_Level     string

any ideas on how to write this? thanks

Hard to say from just your tables. Start of easy with one table, and extend your query with a join one table at a time.

I may be missing something here, but souldn't there be a row in STUDENT for classes taken and some sort of relationship between tables?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.