Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Students that have taken English 1010 and 1020

Status
Not open for further replies.

uncgis

MIS
Apr 9, 2004
58
0
0
US
I need to create a query that will display all students that have taken Eng 1010 AND 1020...For the Course field I put In ("1010","1020")...but the works more like an OR than an AND. It returns all rows of students that have only taken one of the classes...for instance just 1010 and not 1020. Does anyone now of a way around this?

Thanks,
 
Hi!

Try this:

Select YourFields From StudentCourses Where StudentId In (Select StudentId From StudentCourses Where Course = "1010") And StudentId In (Select StudentId From StudentCourses Where Course = "1020")

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thanks for your response....your code worked out...Below is the actual SQL statement..in case you are intrested


Select distinct Shrtckn_Pidm From Shrtckn
Where shrtckn_pidm In (Select shrtckn_pidm
From shrtckn
Where shrtckn_crse_numb in ('1010', '1017','101')
and shrtckn_subj_code in ('ENGL','EH'))
And shrtckn_pidm In (Select shrtckn_pidm
From shrtckn
Where shrtckn_crse_numb IN ('1020', '1027','102')
and shrtckn_subj_code in ('ENGL','EH'))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top