Easy SQL Group-By question. (I'm new) -


I'm new to SQL, so hopefully it's a simple answer.

I have a student table (student ID, name, status ID) and student class table (student ID, class ID). I have been asked to create a view from the tables above:

Class ID: (Group Rate)

The number of students in each class

Students count where the status is as ID = 1 activates

The number of students where the ID = 2 activates

I easily group up I can calculate the number of students IID colonum and students, but I think counting Only a few lines can be asked to count the zodiac. As soon as I add, where do I say that I have records or because of which I count in other columns. Do I need to write some different questions and then get involved in the results of each?

Thanks for any help!

- David

This is ANSI SQL (unless your SQL implementation is ANSI compatible "ACTIVES", SM (case 2 in case of case status) as SELECT class ID, student (student), SM (Case Status ID when 1 was 1 ELSE 0 EDD) "1Activs" as 1 ELSE 0nd), Student ID Class = Student on Classroom Class Inner Join. StudentID Group by ClassID


Comments