Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

SQLplus

Name: How to count 0 2008-10-29 19:53

I'm trying to count the number of 'classes' each student is taking, but I'm supposed to report back 0 if there are none. Right now, it just doesn't respond with the student.
Anyone out there been through a database class who solved this?

Name: How to count 0 2008-10-29 20:18

select student.student_id, student_name, count(student.student_id)
from student, enrolls
where student.student_id=enrolls.student_id
group by student.student_id, student_name;


This is what I'm currently using.
Are you suggesting I union after this whole statement like:

.
.
.
union
select student.student_id, student_name, 0 as n_classes /*new variable name?*/
from student

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List