var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How do I create and AND Where clause?
I have a table that has rows of student_id's and class_codes.
How do I SELECT people that have taken multiple classes?
If I say
WHERE class_code = '1' AND class_code = '2' AND class_code = '3'
No rows get returned because no single row could have all three values in it.
I think I need some sort of nested SELECT statment, or VIEW, but what do I know?!
Thanks in advance,
if you need only the student identifier than use something like this:
select student, count(1) from table group by username
having count(1) > 1
Hope that helps
If you would like to get the student id and names who have multiple classes.
select table2.student,table1.name from table1 inner join
(select student from table2 group by student
having count(student) > 1) as table2 on table2.student=table1.student
table1 = student master file
table2 = enrollment transaction file
student = unique student id